Skip to content
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

sloctl does not resolve to environment variables SLOCTL_CLIENT_ID SLOCTL_CLIENT_SECRET when running as root in version 0.0.87 #12

Closed
heshamelsherif97 opened this issue May 23, 2023 · 7 comments

Comments

@heshamelsherif97
Copy link

Steps to reproduce

As root user

export SLOCTL_CLIENT_ID="xxxx"
export SLOCTL_CLIENT_SECRET="xxxx"
sloctl get slos

Results in error

No context was set in the current configuration file.
At least one context must be provided and set as default in the current configuration file.
Run 'sloctl config add-context' or indicate the path to the file using '--config' flag.
Sloctl also accepts configuration via environmental variables, set 'SLOCTL_CLIENT_ID' and 'SLOCTL_CLIENT_SECRET'.
Visit sloctl documentation for more details: https://docs.nobl9.com/sloctl-user-guide.

Error: context "default" is not present in the config file /root/.config/nobl9/config.toml
@nieomylnieja
Copy link
Contributor

hey @heshamelsherif97 :) First of all, why are you running sloctl from root user? Are you sure the envs you exported are available in the root namespace?

@nieomylnieja
Copy link
Contributor

I checked, and we've got a bug there, which breaks this workflow, I'll be fixing this and let you know once the new version is published.
For a temporary fix, if you don't want to operate on the config.toml file you can create a dummy config.toml with the following contents:

[Contexts]
  [Contexts.default]

@heshamelsherif97
Copy link
Author

@nieomylnieja
Using docker as well reproduces the issue on my side running

docker run -e SLOCTL_CLIENT_ID="xxxxx" -e SLOCTL_CLIENT_SECRET="xxxx"  nobl9/sloctl:latest get slos

results

No context was set in the current configuration file.
At least one context must be provided and set as default in the current configuration file.
Run 'sloctl config add-context' or indicate the path to the file using '--config' flag.
Sloctl also accepts configuration via environmental variables, set 'SLOCTL_CLIENT_ID' and 'SLOCTL_CLIENT_SECRET'.
Visit sloctl documentation for more details: https://docs.nobl9.com/sloctl-user-guide.

Error: context "default" is not present in the config file /.config/nobl9/config.toml

@nieomylnieja
Copy link
Contributor

nieomylnieja commented May 24, 2023

@heshamelsherif97 the new version which should fix the issues you've encountered is here: https://github.com/nobl9/sloctl/releases/tag/v0.0.88 :)
For now you have to slightly modify the command to make it work on no config file setup:

docker run -e SLOCTL_CLIENT_ID="xxxxx" -e SLOCTL_CLIENT_SECRET="xxxx"  nobl9/sloctl:latest get slos --no-config-file

I'll update the example in this repo too.

@nieomylnieja
Copy link
Contributor

Appendix: the v0.0.89 version completely fixes the issue, you can run the example command without problems now. Let me know If this solves your issues!

@heshamelsherif97
Copy link
Author

Thanks a lot @nieomylnieja Works now

@nieomylnieja
Copy link
Contributor

glad to hear that and sorry for the inconvenience!

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

No branches or pull requests

2 participants