fix: ensure $ABRA_DIR/servers is 0600
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Also remove deprecated folders while I'm here: `vendor` / `backup` See #580
This commit is contained in:
24
cli/run.go
24
cli/run.go
@ -31,21 +31,21 @@ func Run(version, commit string) {
|
||||
"upgrade",
|
||||
},
|
||||
PersistentPreRun: func(cmd *cobra.Command, args []string) {
|
||||
paths := []string{
|
||||
config.ABRA_DIR,
|
||||
config.SERVERS_DIR,
|
||||
config.RECIPES_DIR,
|
||||
config.LOGS_DIR,
|
||||
config.VENDOR_DIR, // TODO(d1): remove > 0.9.x
|
||||
config.BACKUP_DIR, // TODO(d1): remove > 0.9.x
|
||||
dirs := []map[string]os.FileMode{
|
||||
{config.ABRA_DIR: 0764},
|
||||
{config.SERVERS_DIR: 0600},
|
||||
{config.RECIPES_DIR: 0764},
|
||||
{config.LOGS_DIR: 0764},
|
||||
}
|
||||
|
||||
for _, path := range paths {
|
||||
if err := os.Mkdir(path, 0764); err != nil {
|
||||
if !os.IsExist(err) {
|
||||
log.Fatal(err)
|
||||
for _, dir := range dirs {
|
||||
for path, perm := range dir {
|
||||
if err := os.Mkdir(path, perm); err != nil {
|
||||
if !os.IsExist(err) {
|
||||
log.Fatal(err)
|
||||
}
|
||||
continue
|
||||
}
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user