Skip to content
This repository was archived by the owner on Sep 18, 2025. It is now read-only.

fix: tweak the logic to fix config merging - #115

Merged
kujtimiihoxha merged 1 commit into
opencode-ai:mainfrom
rekram1-node:fix-config-merging
May 1, 2025
Merged

kujtimiihoxha merged 1 commit into
opencode-ai:mainfrom
rekram1-node:fix-config-merging

Conversation

@rekram1-node

Copy link
Copy Markdown
Contributor

Should fix: #71

This fixes issues with merging configurations. Previously, If I didn't set an environment variable for say anthropic, but I had in my configuration file the following:

{
  "providers": {
      "anthropic": {
        "apiKey": "***",
        "disabled": false
      }
  }
}

The I would get "Error: model not supported"

These changes ensure that we read in the file configuration before setting defaults so a user won't have to explicitly configure every agent in their configuration file.

Also, setProviderDefaults will NOT override settings already configured because viper will check if the values have been set or not.

Comment thread internal/config/config.go

// Anthropic configuration
if apiKey := os.Getenv("ANTHROPIC_API_KEY"); apiKey != "" {
if viper.Get("providers.anthropic.apiKey") != "" {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We set these values right at the beginning of setProviderDefaults

@kujtimiihoxha

Copy link
Copy Markdown
Contributor

@rekram1-node I just merged another provider maybe we can update this to include all providers correctly now ?

@rekram1-node

Copy link
Copy Markdown
Contributor Author

@kujtimiihoxha added openrouter

@kujtimiihoxha

Copy link
Copy Markdown
Contributor

@rekram1-node thanks

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

won't launch with default configs

2 participants