-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Kubernetes module triggers without env vars #5978
Comments
I can confirm this behavior: it was fine with 1.18.2, but now the above happens in 1.19.0. (EDIT: Earlier it seemed to me that python also exposes this behavior, but there it was due to the detection of the activated env) |
-> if it is unset, it default to "enable", making the check if !is_kube_project.unwrap_or(true) && !have_env_vars {
return None;
} always enabling the module. I guess the fix is intergrating the detect_env_var into the scanner so one can set the default in case all detection variants (files, folders, extensions, env vars) are unset, instead of setting it separately for files/folders/extension and env vars. A workaround if you only want to get triggered by a file is set the env var to something invalid: [kubernetes]
disabled = false
detect_files = ['.k8s']
# Not setting it would enable it always in v1.19.0: https://github.com/starship/starship/issues/5978
detect_env_vars = ['INVALID'] |
I submitted a PR that should hopefully fix this: #5979 |
Bug Report
Current Behavior
The kubernetes module is triggering with this configuration although there is no .k8s file in the current directory:
Upon investigation, this might be caused by the recent addition of detect env vars with #4488
Configuring
detect_env_vars
, e.g. withrestores the correct behavior (the module is not triggering if there is no file and the env variable is not defined)
Expected Behavior
Not defining the detect_env_vars option should not trigger the module.
Possible Solution
I imagine the env var detection done here https://github.com/andytom/starship/blob/4b1cda66417cec0ff146dadf8c673ef7198e919a/src/modules/kubernetes.rs#L110 either is faulty or should only be triggered if the relevant config option is present in the starship configuration.
Environment
Starship Configuration
The text was updated successfully, but these errors were encountered: