Skip to content

Commit

Permalink
Create .glif/config.toml with defaults if it doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
jimpick committed Apr 22, 2024
1 parent 1c53a19 commit 5208410
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@ func initConfig() {
if errors.Is(err, fs.ErrNotExist) {
logFatalf("No config file found at %s\n", viper.ConfigFileUsed())
} else if _, ok := err.(viper.ConfigFileNotFoundError); ok {
// Config file not found; ignore error if desired
fmt.Fprintln(os.Stderr, "Warning: No config file found.")
// No .glif/config.toml, populate with mainnet defaults
viper.Set("daemon.rpc-url", deploy.Extern.LotusDialAddr)
viper.Set("daemon.token", "")
viper.SafeWriteConfig()
} else {
logFatalf("Config file error: %v\n", err)
}
Expand Down

0 comments on commit 5208410

Please sign in to comment.