File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,11 @@ import (
1313 "github.com/tursodatabase/turso-cli/internal/flags"
1414)
1515
16+ const (
17+ settingsFileMode = 0o600
18+ settingsDirMode = 0o700
19+ )
20+
1621type Settings struct {
1722 changed bool
1823}
@@ -44,12 +49,12 @@ func ReadSettings() (*Settings, error) {
4449 if err != nil {
4550 return nil , err
4651 }
47- _ = os .Chmod (configPath , 0o700 )
52+ _ = os .Chmod (configPath , settingsDirMode )
4853
4954 viper .SetConfigName ("settings" )
5055 viper .SetConfigType ("json" )
5156 viper .AddConfigPath (configPath )
52- viper .SetConfigPermissions (0o600 )
57+ viper .SetConfigPermissions (settingsFileMode )
5358 configFile := path .Join (configPath , "settings.json" )
5459 if abs , err := filepath .Abs (configFile ); err == nil {
5560 configFile = abs
@@ -100,7 +105,7 @@ func TryToPersistChanges() error {
100105 return fmt .Errorf ("failed to persist turso settings file: %w" , err )
101106 }
102107 if configFile := viper .ConfigFileUsed (); configFile != "" {
103- _ = os .Chmod (configFile , 0o600 )
108+ _ = os .Chmod (configFile , settingsFileMode )
104109 }
105110 return nil
106111}
You can’t perform that action at this time.
0 commit comments