MCPcopy Create free account
hub / github.com/OctopusDeploy/cli / getConfigPath

Function getConfigPath

pkg/config/config.go:104–120  ·  view source on GitHub ↗

getConfigPath works out the directory where the config file should be saved and returns it. does not modify the global viper

()

Source from the content-addressed store, hash-verified

102// getConfigPath works out the directory where the config file should be saved and returns it.
103// does not modify the global viper
104func getConfigPath() (string, error) {
105 if runtime.GOOS == "windows" {
106 if appdataPath := os.Getenv(appData); appdataPath != "" {
107 configPath := filepath.Join(appdataPath, "octopus")
108 return configPath, nil
109 } else {
110 return "", fmt.Errorf("error could not find path to appdata")
111 }
112 }
113 // is unix
114 home, err := os.UserHomeDir()
115 if err != nil {
116 return "", fmt.Errorf("error could not find user home directory: %w", err)
117 }
118 configPath := filepath.Join(home, ".config", "octopus")
119 return configPath, nil
120}
121
122func IsValidKey(key string) bool {
123 // Deliberate reach-out to the global viper instance here.

Callers 2

SetupFunction · 0.85
EnsureConfigPathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected