forked from stellar/go
/
root.go
40 lines (33 loc) · 851 Bytes
/
root.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
package cmd
import (
"fmt"
"os"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
horizonclient "github.com/stellar/go/clients/horizonclient"
hlog "github.com/stellar/go/support/log"
)
var DatabaseURL string
var Logger = hlog.New()
var Client = horizonclient.DefaultPublicNetClient // TODO: make this configurable
var rootCmd = &cobra.Command{
Use: "ticker",
Short: "Stellar Development Foundation Ticker.",
Long: `A tool to provide Stellar Asset and Market data.`,
}
func init() {
rootCmd.PersistentFlags().StringVarP(
&DatabaseURL,
"db-url",
"d",
"postgres://localhost:5432/stellarticker01?sslmode=disable",
"database URL, such as: postgres://user:pass@localhost:5432/ticker",
)
Logger.SetLevel(logrus.DebugLevel)
}
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}