commit
ce0f11a651
|
@ -52,18 +52,31 @@ func homeDir() (string, error) {
|
|||
}
|
||||
|
||||
func configFile() (string, error) {
|
||||
dir, err := homeDir()
|
||||
if err != nil {
|
||||
return "", err
|
||||
var dir string
|
||||
if cd := os.Getenv("PACKER_CONFIG_DIR"); cd != "" {
|
||||
log.Printf("Detected config directory from env var: %s", cd)
|
||||
dir = cd
|
||||
} else {
|
||||
homedir, err := homeDir()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
dir = homedir
|
||||
}
|
||||
|
||||
return filepath.Join(dir, defaultConfigFile), nil
|
||||
}
|
||||
|
||||
func configDir() (string, error) {
|
||||
dir, err := homeDir()
|
||||
if err != nil {
|
||||
return "", err
|
||||
var dir string
|
||||
if cd := os.Getenv("PACKER_CONFIG_DIR"); cd != "" {
|
||||
log.Printf("Detected config directory from env var: %s", cd)
|
||||
dir = cd
|
||||
} else {
|
||||
homedir, err := homeDir()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
dir = homedir
|
||||
}
|
||||
|
||||
return filepath.Join(dir, defaultConfigDir), nil
|
||||
|
|
|
@ -16,6 +16,8 @@ each can be found below:
|
|||
of the configuration file is basic JSON. See the [core configuration
|
||||
page](/docs/other/core-configuration.html).
|
||||
|
||||
- `PACKER_CONFIG_DIR` - The location of the `.packer.d` config directory
|
||||
|
||||
- `PACKER_LOG` - Setting this to any value other than "" (empty string) or
|
||||
"0" will enable the logger. See the [debugging
|
||||
page](/docs/other/debugging.html).
|
||||
|
|
Loading…
Reference in New Issue