You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit f665f23
Browse filesBrowse the repository at this point in the historyBrowse files
feat(create): expose Hetzner config as CLI flags; drop required .onctl YAML (#918)
* feat(create): expose Hetzner/global config as CLI flags; drop required .onctl YAML
onctl previously required a .onctl config dir (from `onctl init`) and fatally
refused to run without it. For Hetzner, every setting that lived in
hetzner.yaml / onctl.yaml is now a CLI flag with a default, so onctl works with
no config files on disk.
- setDefaults() (cmd/common.go): viper.SetDefault for all Hetzner + global keys
(location=fsn1, vm.type=cpx21, vm.image=ubuntu-22.04, vm.username=root,
ssh.publicKey/privateKey, vm.cloud-init.timeout=3m, actions.githubOwner).
- Generic create flags --type/--location/--username/--cloud-init-timeout
(+ existing --image), each viper.BindPFlag'd to the key the code already
reads, so values flow through unchanged. Defaults match the old YAML.
- Persistent --provider flag (overrides ONCTL_CLOUD); --github-owner on action.
- Provider construction + config load moved from Execute() into
rootCmd.PersistentPreRunE so it runs after flag parsing (flags can override
config). Missing .onctl is now best-effort (logged), not fatal.
- Remove embedded init/hetzner.yaml and init/onctl.yaml (defaults are in code).
Other providers keep their YAML for now (separate follow-up).
Credentials are unaffected (still env: HCLOUD_TOKEN, etc.). Adds
flags_defaults_test.go covering flag existence, viper binding, and defaults.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013fQKc2HmtfdtBeKfXBXab6
* fix: address review feedback on hetzner-flags-no-yaml PR
- Keep config errors fatal outside Hetzner by extracting initState()
from PersistentPreRunE, matching the pre-flags behavior for aws/gcp/
azure/firecracker while still defaulting Hetzner when .onctl is missing.
- Add ensureProvider() and skip __complete/__completeNoDesc in
PersistentPreRunE so shell completion doesn't dereference a nil
provider or fatally error when config is missing.
- Fix TestCreateFlagsBindToViper flaking under randomized test order by
loading an isolated empty config before asserting on viper defaults.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0181WDmhDAKfTzXfFUZFKGvM
---------
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
0 commit comments