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

Pickup server URL and API key from environment variables #295

Open
yooakim opened this issue Sep 5, 2023 · 3 comments
Open

Pickup server URL and API key from environment variables #295

yooakim opened this issue Sep 5, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@yooakim
Copy link

yooakim commented Sep 5, 2023

It would be good if the SEQCLI could be updated to pickup the server URL and the API key from the environment.

I know I could modify the call and include them from my local environment. But if the SEQCLI was updated to look for default keys of SEQ_SERVER_URL and SEQ_API_KEY it would make life easier :-)

I am not sure where in the codebase this need to be added but I'd be happy to help if I could get pointers to some introduction to the code and how to contribute.

@nblumhardt
Copy link
Member

Thanks for dropping us a line! It'd be great if we can understand the scenario a little more if possible - in which situations is it easier to consume settings from the environment rather than set them up through the config set command or command-line args?

@yooakim
Copy link
Author

yooakim commented Sep 5, 2023

We are considering using the SEQCLI in a pipeline. Our templates already load keys from key vaults and in this scenario it would be less work if all we need is to install the dotnet global tool and run it.

Given that our environment variables are set.

Does this make sense?

Not a big issue... But nice if it would work.

@nblumhardt
Copy link
Member

Sorry about the slow reply, release week here 😅.

Thanks for the additional info; yes, I think I can see how it frees up people writing scripts further down the pipeline to ignore details of how seqcli is configured 👍

Seq and Seq Forwarder both use a common convention for environment variable naming based on the matching JSON configuration fields that I think would lead us to:

SEQCLI_CONNECTION_APIKEY
SEQCLI_CONNECTION_SERVERURL
SEQCLI_OUTPUT_DISABLECOLOR
SEQCLI_OUTPUT_FORCECOLOR

(Covering the options output by seqcli config.)

There's a PR in Seq Forwarder that might be a good starting point for an approach/to avoid the couple of gotchas we encountered over there:

datalust/seq-forwarder#57

Forwarder doesn't use nested configuration objects, so the code doesn't take that into account as far as I can recall. (Seq does do this, but it has a much more heavyweight configuration system that wouldn't really be appropriate for the CLI.)

@nblumhardt nblumhardt added the enhancement New feature or request label Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants