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

Argument defaults from environment variables? #4105

Merged
merged 1 commit into from
May 24, 2024

Conversation

nigoroll
Copy link
Member

@nigoroll nigoroll commented May 12, 2024

After 15 years of tirelessly repeating -n <foo> for each and every varnish admin command, I wonder: is it time to set defaults from environment variables?

This PR is not remotely complete. It is merely to ask about opinions.

@nigoroll nigoroll changed the title Argument defaults from environment variables Argument defaults from environment variables? May 12, 2024
@gquintard
Copy link
Member

Yes please, that would make containers way easier to use

@@ -467,6 +467,7 @@ main(int argc, char * const *argv)
printf(OPTARG "\n");
exit(0);
}
n_arg = getenv("VARNISH_WORKING_DIR");
Copy link
Member

Choose a reason for hiding this comment

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

Look like something we would want in libvarnishapi instead.

Mandatory bikeshedding: VARNISH_WORKDIR

Copy link
Member Author

Choose a reason for hiding this comment

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

Look like something we would want in libvarnishapi instead.

Yes, just varnishadm does not use VUT.

Mandatory bikeshedding: VARNISH_WORKDIR

please take a look:

$ git grep -Ei 'work.?dir' 
$ git grep -Ei 'working.?dir' 

If I did not overlook anything, there is one error message where it is "workdir", otherwise "workdir" is only used in code and all other messages and documentation are for "working directory". I abbreviated to "WORKING_DIR", but probably it should be VARNISH_WORKING_DIRECTORY?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, just varnishadm does not use VUT.

I was referring to VSM_Attach().

all other messages and documentation are for "working directory". I abbreviated to "WORKING_DIR", but probably it should be VARNISH_WORKING_DIRECTORY?

If anything, I'd rather keep environment variables short and have the documentation use the whole "working directory" phrase.

@nigoroll
Copy link
Member Author

bugwash: the bikeshed color is going to be VARNISH_DEFAULT_N and we are keeping it there for now, as phk is skeptical about other defaults. But at least the name scheme is generic.

nigoroll added a commit that referenced this pull request May 24, 2024
with greetings from the rabbit-hole opened by #4105
nigoroll added a commit that referenced this pull request May 24, 2024
The host name default referenced by VUT_OPT_n is long gone since
879c9b3

Refer to varnishd(1) to avoid the documentation getting out of sync.

Ref #4105
@nigoroll nigoroll marked this pull request as ready for review May 24, 2024 10:53
@nigoroll nigoroll merged commit 8f8d26c into varnishcache:master May 24, 2024
1 of 14 checks passed
@nigoroll nigoroll deleted the arg_default_getenv branch May 24, 2024 10:56
dridi added a commit that referenced this pull request May 24, 2024
Putting the new fallback next to the historical fallback.

Refs #4105
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.

None yet

3 participants