Skip to content

fix: remove config file location from the config #813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions pkg/config/cliconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ func (a *AuthConfig) UnmarshalJSON(data []byte) error {
}

type CLIConfig struct {
Auths map[string]AuthConfig `json:"auths,omitempty"`
CredentialsStore string `json:"credsStore,omitempty"`
GPTScriptConfigFile string `json:"gptscriptConfig,omitempty"`
GatewayURL string `json:"gatewayURL,omitempty"`
Integrations map[string]string `json:"integrations,omitempty"`
Auths map[string]AuthConfig `json:"auths,omitempty"`
CredentialsStore string `json:"credsStore,omitempty"`
GatewayURL string `json:"gatewayURL,omitempty"`
Integrations map[string]string `json:"integrations,omitempty"`

auths map[string]types.AuthConfig
authsLock *sync.Mutex
location string
}

func (c *CLIConfig) Sanitize() *CLIConfig {
Expand Down Expand Up @@ -93,7 +93,7 @@ func (c *CLIConfig) Save() error {
if err != nil {
return err
}
return os.WriteFile(c.GPTScriptConfigFile, data, 0655)
return os.WriteFile(c.location, data, 0655)
}

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

func (c *CLIConfig) GetFilename() string {
return c.GPTScriptConfigFile
return c.location
}

func ReadCLIConfig(gptscriptConfigFile string) (*CLIConfig, error) {
Expand All @@ -133,8 +133,8 @@ func ReadCLIConfig(gptscriptConfigFile string) (*CLIConfig, error) {
return nil, err
}
result := &CLIConfig{
authsLock: &sync.Mutex{},
GPTScriptConfigFile: gptscriptConfigFile,
authsLock: &sync.Mutex{},
location: gptscriptConfigFile,
}
if err := json.Unmarshal(data, result); err != nil {
return nil, err
Expand All @@ -158,7 +158,7 @@ func ReadCLIConfig(gptscriptConfigFile string) (*CLIConfig, error) {
default:
errMsg += " (use 'file')"
}
errMsg += fmt.Sprintf("\nPlease edit your config file at %s to fix this.", result.GPTScriptConfigFile)
errMsg += fmt.Sprintf("\nPlease edit your config file at %s to fix this.", result.location)

return nil, errors.New(errMsg)
}
Expand Down