forked from smartcontractkit/chainlink
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
41 lines (36 loc) · 1.51 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
package main
import (
"os"
"github.com/smartcontractkit/chainlink/core/cmd"
"github.com/smartcontractkit/chainlink/core/logger"
"github.com/smartcontractkit/chainlink/core/store/orm"
)
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 {
config := orm.NewConfig()
prompter := cmd.NewTerminalPrompter()
cookieAuth := cmd.NewSessionCookieAuthenticator(config, cmd.DiskCookieStore{Config: config})
return &cmd.Client{
Renderer: cmd.RendererTable{Writer: os.Stdout},
Config: config,
AppFactory: cmd.ChainlinkAppFactory{},
KeyStoreAuthenticator: cmd.TerminalKeyStoreAuthenticator{Prompter: prompter},
FallbackAPIInitializer: cmd.NewPromptingAPIInitializer(prompter),
Runner: cmd.ChainlinkRunner{},
HTTP: cmd.NewAuthenticatedHTTPClient(config, cookieAuth),
CookieAuthenticator: cookieAuth,
FileSessionRequestBuilder: cmd.NewFileSessionRequestBuilder(),
PromptingSessionRequestBuilder: cmd.NewPromptingSessionRequestBuilder(prompter),
ChangePasswordPrompter: cmd.NewChangePasswordPrompter(),
PasswordPrompter: cmd.NewPasswordPrompter(),
}
}