Skip to content
This repository has been archived by the owner on Jun 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #42
Browse files Browse the repository at this point in the history
Release v0.3.3
  • Loading branch information
bsrinivas8687 authored Jun 1, 2021
2 parents 9cf8785 + 2c6f037 commit b7b6bf7
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions cli/cmd/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ func ServerCmd(cfg *types.Config) *cobra.Command {
listenURL string
keyFile string
certFile string
defCfg = types.NewConfig().WithDefaultValues()
)

cmd := &cobra.Command{
Use: "server",
Short: "Start REST API server",
PreRunE: func(cmd *cobra.Command, args []string) error {
defCfg := types.NewConfig().WithDefaultValues()
if viper.GetString(flagCORSAllowedOrigins) != defCfg.CORS.AllowedOrigins {
cfg.CORS.AllowedOrigins = viper.GetString(flagCORSAllowedOrigins)
}
Expand Down Expand Up @@ -155,7 +155,7 @@ func ServerCmd(cfg *types.Config) *cobra.Command {
cmd.Flags().StringVar(&listenURL, flagListenURL, types.DefaultListenURL, "")
cmd.Flags().StringVar(&keyFile, flagTLSKey, filepath.Join(types.DefaultHomeDirectory, "tls.key"), "")
cmd.Flags().StringVar(&certFile, flagTLSCrt, filepath.Join(types.DefaultHomeDirectory, "tls.crt"), "")
cmd.Flags().String(flagCORSAllowedOrigins, cfg.CORS.AllowedOrigins, "")
cmd.Flags().String(flagCORSAllowedOrigins, defCfg.CORS.AllowedOrigins, "")

_ = viper.BindPFlag(flagCORSAllowedOrigins, cmd.Flags().Lookup(flagCORSAllowedOrigins))

Expand Down
22 changes: 11 additions & 11 deletions cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ func main() {
sent.GetConfig().Seal()

var (
cfg = types.NewConfig().WithDefaultValues()
root = &cobra.Command{
cfg = types.NewConfig()
defCfg = types.NewConfig().WithDefaultValues()
root = &cobra.Command{
Use: "sdccli",
SilenceUsage: true,
PersistentPreRunE: func(_ *cobra.Command, _ []string) error {
Expand All @@ -42,7 +43,7 @@ func main() {

cfgPath := filepath.Join(home, "config.toml")
if _, err := os.Stat(cfgPath); err != nil {
if err := cfg.SaveToPath(cfgPath); err != nil {
if err := cfg.WithDefaultValues().SaveToPath(cfgPath); err != nil {
return err
}
}
Expand All @@ -51,7 +52,6 @@ func main() {
return err
}

defCfg := types.NewConfig().WithDefaultValues()
if cfg.Version != defCfg.Version {
if err := defCfg.SaveToPath(cfgPath); err != nil {
return err
Expand Down Expand Up @@ -90,13 +90,13 @@ func main() {
)

root.PersistentFlags().String(types.FlagHome, types.DefaultHomeDirectory, "")
root.PersistentFlags().String(flagChainBroadcastMode, cfg.Chain.BroadcastMode, "")
root.PersistentFlags().Float64(flagChainGasAdjustment, cfg.Chain.GasAdjustment, "")
root.PersistentFlags().String(flagChainGasPrices, cfg.Chain.GasPrices, "")
root.PersistentFlags().Uint64(flagChainGas, cfg.Chain.Gas, "")
root.PersistentFlags().String(flagChainID, cfg.Chain.ID, "")
root.PersistentFlags().String(flagChainRPCAddress, cfg.Chain.RPCAddress, "")
root.PersistentFlags().Bool(flagChainSimulateAndExecute, cfg.Chain.SimulateAndExecute, "")
root.PersistentFlags().String(flagChainBroadcastMode, defCfg.Chain.BroadcastMode, "")
root.PersistentFlags().Float64(flagChainGasAdjustment, defCfg.Chain.GasAdjustment, "")
root.PersistentFlags().String(flagChainGasPrices, defCfg.Chain.GasPrices, "")
root.PersistentFlags().Uint64(flagChainGas, defCfg.Chain.Gas, "")
root.PersistentFlags().String(flagChainID, defCfg.Chain.ID, "")
root.PersistentFlags().String(flagChainRPCAddress, defCfg.Chain.RPCAddress, "")
root.PersistentFlags().Bool(flagChainSimulateAndExecute, defCfg.Chain.SimulateAndExecute, "")

_ = viper.BindPFlag(types.FlagHome, root.PersistentFlags().Lookup(types.FlagHome))
_ = viper.BindPFlag(flagChainBroadcastMode, root.PersistentFlags().Lookup(flagChainBroadcastMode))
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sentinel",
"version": "0.3.2",
"version": "0.3.3",
"main": "./electron/index.js",
"homepage": "./",
"description": "Sentinel desktop and web client.",
Expand Down

0 comments on commit b7b6bf7

Please sign in to comment.