Skip to content

Commit 71daaaa

Browse files
loresusopoiana
authored andcommitted
fix: catch os.IsNotExists error when creating config
Signed-off-by: Lorenzo Susini <[email protected]>
1 parent d907121 commit 71daaaa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/config/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func Load(path string) error {
164164
viper.SetDefault(FollowerFalcoVersionsKey, DefaultFollower.FalcoVersions)
165165

166166
err = viper.ReadInConfig()
167-
if errors.As(err, &viper.ConfigFileNotFoundError{}) {
167+
if errors.As(err, &viper.ConfigFileNotFoundError{}) || os.IsNotExist(err) {
168168
// If the config is not found, we create the file with the
169169
// already set up default values
170170
if err = os.MkdirAll(filepath.Dir(absolutePath), 0o700); err != nil {

0 commit comments

Comments
 (0)