Skip to content

Commit

Permalink
moved config file to a parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
mgravitt committed Mar 14, 2020
1 parent 913117e commit 3dc7b2f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 5 additions & 3 deletions configs/example-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
IPFS:
Endpoint: ipfs.digscar.com:5001
Endpoint: ec2-3-232-158-110.compute-1.amazonaws.com:5001
Eosio:
Endpoint: https://kylin.eosusa.news
PublishAccount: messengerbus
PublishPrivateKey: 5KAP1zytghuvowgprSPLNasajibZcxf4KMgdgNbrNj98xhcGAUa
Dfuse:
Protocol: GraphQL # WebSocket will use WSEndpoint; else it defaults to GraphQL
WSEndpoint: wss://kylin.eos.dfuse.io/v1/stream
Origin: github.com/eosio-enterprise/chappe
ApiKey: <insert dfuse API key here>
ApiKey: <<insert dfuse api key here>>
GraphQLEndpoint: kylin.eos.dfuse.io:443
KeyDirectory: channels/
PublishInterval: 1s # Go Duration object
PublishInterval: 5s # Go Duration object
12 changes: 7 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ import (

func main() {

viper.SetConfigFile("configs/config.yaml")
if err := viper.ReadInConfig(); err != nil {
log.Fatalf("config file not found: %s", err)
}

cmdVersion := cmd.MakeVersion()
cmdCreate := cmd.MakeCreate()
cmdUpdate := cmd.MakeUpdate()
Expand All @@ -30,6 +25,13 @@ func main() {
},
}

var configFile string
rootCmd.Flags().StringVarP(&configFile, "config-file", "c", "configs/config.yaml", "Path/name of configuration file")
viper.SetConfigFile(configFile) //"configs/config.yaml")
if err := viper.ReadInConfig(); err != nil {
log.Fatalf("config file not found: %s", err)
}

rootCmd.AddCommand(cmdCreate)
rootCmd.AddCommand(cmdVersion)
rootCmd.AddCommand(cmdUpdate)
Expand Down

0 comments on commit 3dc7b2f

Please sign in to comment.