Skip to content

Commit c516f7b

Browse files
authored
fix: remove config file location from the config (#813)
Signed-off-by: Grant Linville <[email protected]>
1 parent f8f81a5 commit c516f7b

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

pkg/config/cliconfig.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@ func (a *AuthConfig) UnmarshalJSON(data []byte) error {
5252
}
5353

5454
type CLIConfig struct {
55-
Auths map[string]AuthConfig `json:"auths,omitempty"`
56-
CredentialsStore string `json:"credsStore,omitempty"`
57-
GPTScriptConfigFile string `json:"gptscriptConfig,omitempty"`
58-
GatewayURL string `json:"gatewayURL,omitempty"`
59-
Integrations map[string]string `json:"integrations,omitempty"`
55+
Auths map[string]AuthConfig `json:"auths,omitempty"`
56+
CredentialsStore string `json:"credsStore,omitempty"`
57+
GatewayURL string `json:"gatewayURL,omitempty"`
58+
Integrations map[string]string `json:"integrations,omitempty"`
6059

6160
auths map[string]types.AuthConfig
6261
authsLock *sync.Mutex
62+
location string
6363
}
6464

6565
func (c *CLIConfig) Sanitize() *CLIConfig {
@@ -93,7 +93,7 @@ func (c *CLIConfig) Save() error {
9393
if err != nil {
9494
return err
9595
}
96-
return os.WriteFile(c.GPTScriptConfigFile, data, 0655)
96+
return os.WriteFile(c.location, data, 0655)
9797
}
9898

9999
func (c *CLIConfig) GetAuthConfigs() map[string]types.AuthConfig {
@@ -113,7 +113,7 @@ func (c *CLIConfig) GetAuthConfigs() map[string]types.AuthConfig {
113113
}
114114

115115
func (c *CLIConfig) GetFilename() string {
116-
return c.GPTScriptConfigFile
116+
return c.location
117117
}
118118

119119
func ReadCLIConfig(gptscriptConfigFile string) (*CLIConfig, error) {
@@ -133,8 +133,8 @@ func ReadCLIConfig(gptscriptConfigFile string) (*CLIConfig, error) {
133133
return nil, err
134134
}
135135
result := &CLIConfig{
136-
authsLock: &sync.Mutex{},
137-
GPTScriptConfigFile: gptscriptConfigFile,
136+
authsLock: &sync.Mutex{},
137+
location: gptscriptConfigFile,
138138
}
139139
if err := json.Unmarshal(data, result); err != nil {
140140
return nil, err
@@ -158,7 +158,7 @@ func ReadCLIConfig(gptscriptConfigFile string) (*CLIConfig, error) {
158158
default:
159159
errMsg += " (use 'file')"
160160
}
161-
errMsg += fmt.Sprintf("\nPlease edit your config file at %s to fix this.", result.GPTScriptConfigFile)
161+
errMsg += fmt.Sprintf("\nPlease edit your config file at %s to fix this.", result.location)
162162

163163
return nil, errors.New(errMsg)
164164
}

0 commit comments

Comments
 (0)