forked from smartcontractkit/chainlink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
46 lines (40 loc) · 1.53 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package main
import (
"os"
"time"
"github.com/smartcontractkit/chainlink/cmd"
"github.com/smartcontractkit/chainlink/logger"
"github.com/smartcontractkit/chainlink/store"
)
func init() {
time.LoadLocation("UTC")
}
func main() {
Run(NewProductionClient(), os.Args...)
}
// Run runs the CLI, providing further command instructions by default.
func Run(client *cmd.Client, args ...string) {
app := cmd.NewApp(client)
logger.WarnIf(app.Run(args))
}
// NewProductionClient configures an instance of the CLI to be used
// in production.
func NewProductionClient() *cmd.Client {
cfg := store.NewConfig()
prompter := cmd.NewTerminalPrompter()
cookieAuth := cmd.NewSessionCookieAuthenticator(cfg, cmd.DiskCookieStore{Config: cfg})
return &cmd.Client{
Renderer: cmd.RendererTable{Writer: os.Stdout},
Config: cfg,
AppFactory: cmd.ChainlinkAppFactory{},
KeyStoreAuthenticator: cmd.TerminalKeyStoreAuthenticator{Prompter: prompter},
FallbackAPIInitializer: cmd.NewPromptingAPIInitializer(prompter),
Runner: cmd.ChainlinkRunner{},
HTTP: cmd.NewAuthenticatedHTTPClient(cfg, cookieAuth),
CookieAuthenticator: cookieAuth,
FileSessionRequestBuilder: cmd.NewFileSessionRequestBuilder(),
PromptingSessionRequestBuilder: cmd.NewPromptingSessionRequestBuilder(prompter),
ChangePasswordPrompter: cmd.NewChangePasswordPrompter(),
PasswordPrompter: cmd.NewPasswordPrompter(),
}
}