mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-11-22 05:10:28 +01:00
Conf files should expand env vars (#363)
This commit is contained in:
parent
37f9bd9a8f
commit
a01fc3df3f
@ -69,7 +69,11 @@ func loadEnvFiles(directory string) ([]configFile, error) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
p := filepath.Join(directory, item.Name())
|
p := filepath.Join(directory, item.Name())
|
||||||
envFile, err := godotenv.Read(p)
|
f, err := os.ReadFile(p)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("loadEnvFiles: error reading %s: %w", item.Name(), err)
|
||||||
|
}
|
||||||
|
envFile, err := godotenv.Unmarshal(os.ExpandEnv(string(f)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("loadEnvFiles: error reading config file %s: %w", p, err)
|
return nil, fmt.Errorf("loadEnvFiles: error reading config file %s: %w", p, err)
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
NAME="conf"
|
NAME="$EXPANSION_VALUE"
|
||||||
BACKUP_CRON_EXPRESSION="*/1 * * * *"
|
BACKUP_CRON_EXPRESSION="*/1 * * * *"
|
||||||
|
@ -7,6 +7,7 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
BACKUP_FILENAME: $$NAME.tar.gz
|
BACKUP_FILENAME: $$NAME.tar.gz
|
||||||
BACKUP_FILENAME_EXPAND: 'true'
|
BACKUP_FILENAME_EXPAND: 'true'
|
||||||
|
EXPANSION_VALUE: conf
|
||||||
volumes:
|
volumes:
|
||||||
- ${LOCAL_DIR:-./local}:/archive
|
- ${LOCAL_DIR:-./local}:/archive
|
||||||
- app_data:/backup/app_data:ro
|
- app_data:/backup/app_data:ro
|
||||||
|
Loading…
Reference in New Issue
Block a user