Use filepath.Abs

This commit is contained in:
M. Mert Yildiran 2025-04-13 00:09:58 +03:00
parent 82ea7f99e4
commit 1384d7fe5b
No known key found for this signature in database
GPG Key ID: B2F205E76EB7510B

View File

@ -147,7 +147,12 @@ func GetConfigFilePath(cmd *cobra.Command) string {
configPathOverride, err := cmd.Flags().GetString(ConfigPathFlag)
if err == nil {
if configPathOverride != "" {
return filepath.Join(cwd, configPathOverride)
resolvedConfigPath, err := filepath.Abs(configPathOverride)
if err != nil {
log.Error().Err(err).Msg("--config-path flag path cannot be resolved")
} else {
return resolvedConfigPath
}
}
} else {
log.Error().Err(err).Msg("--config-path flag parser error")