initialize a non-empty config#1158
Conversation
mislav
left a comment
There was a problem hiding this comment.
Love the simplicity of this! I would just suggest that we move the trigger that creates this file to somewhere else. Perhaps NewBlankConfig could be initialized with yaml comments?
context/context.go
Outdated
| cfg, err := config.ParseDefaultConfig() | ||
| if errors.Is(err, os.ErrNotExist) { | ||
| cfg = config.NewBlankConfig() | ||
| cfg, err = config.InitDefaultConfig() |
There was a problem hiding this comment.
We've moved away from Config() accessor resulting in side-effects such as kicking off authentication flow or making filesystem changes. It would be ideal if it could stay like that (i.e. not result in any mutations)
Instead, could we write the default config in case config.Write() was called, but config.yml was non-existent?
There was a problem hiding this comment.
that is much better and i don't know why i thought i couldn't do that
|
Actually I will pre-emptively approve because it's good to ship-as is, but ideally accessing |
This PR initializes a non-empty config. Should a user desire an empty config, they can delete the contents of
config.ymlwhile leaving the file itself in place.The default config contents are:
Closes #1127
Closes #803
TODO