Skip to content

Add koyeb config env var support#308

Merged
bchatelard merged 3 commits intomasterfrom
add-koyeb-config-env-var-support
Apr 2, 2026
Merged

Add koyeb config env var support#308
bchatelard merged 3 commits intomasterfrom
add-koyeb-config-env-var-support

Conversation

@bchatelard
Copy link
Copy Markdown
Member

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for selecting the CLI configuration file via a KOYEB_CONFIG environment variable, with precedence between --config, KOYEB_CONFIG, and the default $HOME/.koyeb.yaml.

Changes:

  • Add KOYEB_CONFIG env var fallback when resolving the config path in login and during root command config initialization.
  • Update CLI help text and the generated reference docs to mention the new env var behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
pkg/koyeb/login.go Allows koyeb login to use KOYEB_CONFIG when --config is not provided.
pkg/koyeb/koyeb.go Adds KOYEB_CONFIG handling in initConfig and updates --config flag help text.
docs/reference.md Updates --config option text across the generated reference docs (and includes other regen deltas).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 199 to +204
if cfgFile != "" {
// Use config file from the flag.
viper.SetConfigFile(cfgFile)
} else if envConfig := os.Getenv("KOYEB_CONFIG"); envConfig != "" {
log.Debugf("Using config file from KOYEB_CONFIG environment variable: %s", envConfig)
viper.SetConfigFile(envConfig)
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

The config file selection logic (flag -> KOYEB_CONFIG -> $HOME/.koyeb.yaml) is now duplicated here and also in pkg/koyeb/login.go. To avoid future drift (e.g., adding another precedence rule in one place but not the other), consider extracting this into a shared helper (e.g., resolveConfigPath/resolveConfigFile) and reusing it in both initConfig and Login.

Copilot uses AI. Check for mistakes.
* [koyeb snapshots](#koyeb-snapshots) - Manage snapshots
* [koyeb version](#koyeb-version) - Get version
* [koyeb volumes](#koyeb-volumes) - Manage persistent volumes
* [koyeb whoami](#koyeb-whoami) - Show information about the currently authenticated user or organization
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

The command index now links to koyeb whoami, but this reference doc does not include a corresponding ## koyeb whoami section, so the link is broken. Either include the whoami markdown in the reference concatenation step (see Makefile gen-doc target) or remove the index entry until the section is generated.

Suggested change
* [koyeb whoami](#koyeb-whoami) - Show information about the currently authenticated user or organization

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Member Author

@bchatelard bchatelard left a comment

Choose a reason for hiding this comment

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

Hydra review

Reviewed head: bdb998042544b558bcd0d4235017d72096a01546

The code change for KOYEB_CONFIG looks sound, but the regenerated reference docs introduce a broken index link for koyeb whoami.

* [koyeb snapshots](#koyeb-snapshots) - Manage snapshots
* [koyeb version](#koyeb-version) - Get version
* [koyeb volumes](#koyeb-volumes) - Manage persistent volumes
* [koyeb whoami](#koyeb-whoami) - Show information about the currently authenticated user or organization
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

[P2] Restore the missing whoami reference section

The regenerated command index now links to koyeb whoami, but this file still has no matching section, so the anchor is broken and readers cannot navigate to the command details from the index. Either include the generated whoami section or remove the index entry from this update.

@bchatelard bchatelard merged commit 048da11 into master Apr 2, 2026
2 checks passed
@bchatelard bchatelard deleted the add-koyeb-config-env-var-support branch April 2, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants