Files
crawlab/core/config/base.go
2024-06-14 15:42:50 +08:00

22 lines
442 B
Go

package config
import (
"github.com/mitchellh/go-homedir"
"github.com/spf13/viper"
"path/filepath"
)
var HomeDirPath, _ = homedir.Dir()
const configDirName = ".crawlab"
const configName = "config.json"
func GetConfigPath() string {
if viper.GetString("metadata") != "" {
MetadataPath := viper.GetString("metadata")
return filepath.Join(MetadataPath, configName)
}
return filepath.Join(HomeDirPath, configDirName, configName)
}