GetConfigFile returns an absolute path of the configuration file.
()
| 60 | |
| 61 | // GetConfigFile returns an absolute path of the configuration file. |
| 62 | func (gf *GlobalFlags) GetConfigFile() (string, error) { |
| 63 | configFile := conv.S(gf.ConfigFile) |
| 64 | |
| 65 | // if specified config file is absolute path, just use it |
| 66 | if !utils.IsBlank(configFile) && filepath.IsAbs(configFile) { |
| 67 | return configFile, nil |
| 68 | } |
| 69 | |
| 70 | if utils.IsBlank(configFile) { |
| 71 | configFile = "./coldbrew.conf" // default: coldbrew.conf |
| 72 | } |
| 73 | |
| 74 | // join with application directory |
| 75 | appDir, err := gf.GetApplicationDirectory() |
| 76 | if err != nil { |
| 77 | return "", err |
| 78 | } |
| 79 | |
| 80 | return filepath.Join(appDir, configFile), nil |
| 81 | } |
| 82 | |
| 83 | func (gf *GlobalFlags) GetAWSClient() *aws.Client { |
| 84 | return aws.NewClient(conv.S(gf.AWSRegion), conv.S(gf.AWSAccessKey), conv.S(gf.AWSSecretKey)) |
no test coverage detected