0
0
forked from toolshed/abra

fix: ensure $ABRA_DIR/servers is 0600

Also remove deprecated folders while I'm here: `vendor` / `backup`

See toolshed/abra#580
This commit is contained in:
2025-08-12 23:01:51 +02:00
committed by decentral1se
parent 452de7fdc2
commit 6849e3554d
2 changed files with 16 additions and 15 deletions

View File

@ -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
}
}