add default aptly config files

config rfiles are read in the following order:

1) ~/.aptly.conf
2) /usr/local/etc/aptly.conf
3) /etc/aptly.conf
This commit is contained in:
Andre Roth
2024-08-03 22:55:25 +00:00
committed by André Roth
parent 32a3943821
commit 8fd48e9fa9
8 changed files with 11 additions and 12 deletions

View File

@@ -96,12 +96,11 @@ func (context *AptlyContext) config() *utils.ConfigStructure {
Fatal(err)
}
} else {
configLocations := []string{
filepath.Join(os.Getenv("HOME"), ".aptly.conf"),
"/etc/aptly.conf",
}
homeLocation := filepath.Join(os.Getenv("HOME"), ".aptly.conf")
configLocations := []string{ homeLocation, "/etc/aptly.conf", }
for _, configLocation := range configLocations {
// FIXME: check if exists, check if readable
err = utils.LoadConfig(configLocation, &utils.Config)
if err == nil {
break
@@ -112,7 +111,7 @@ func (context *AptlyContext) config() *utils.ConfigStructure {
}
if err != nil {
fmt.Fprintf(os.Stderr, "Config file not found, creating default config at %s\n\n", configLocations[0])
fmt.Fprintf(os.Stderr, "Config file not found, creating default config at %s\n\n", homeLocation)
// as this is fresh aptly installation, we don't need to support legacy pool locations
utils.Config.SkipLegacyPool = true