-
Notifications
You must be signed in to change notification settings - Fork 368
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
Discussion: provide a consistent way to override commands configuration #1265
Comments
This all sounds good to me (including priority order and variables prefixing), with two small points.
Providing CLI flags as an alternative to each environment variable sounds good. However, in the other direction, would providing more environment variables (to reflect each CLI flag) encourage users to use those instead of CLI flags? Is this something we want?
I agree we should allow users to override build settings using CLI flags (although I don't have a strong opinion either way). Computing build settings requires retrieving and merging UI settings, normalizing them (e.g. there are several possible cases, paths can optionally start with Lines 78 to 81 in 9ce3a91
Not every CLI command requires all build settings, so we might want to consider the trade-offs of generalizing this solution vs implementing it for each CLI command. |
In some environments it's easier/common to use env variables (e.g. CI) and other flags (local dev). |
This makes sense. Providing a general solution might also help simplify the code by abstracting it to a common utility. |
Adding to the confusion, users can also use the |
We got some customer feedback on the file-based configuration docs page about [context.dev.environment] not being documented.
They're correct that we don't have it in the official docs, but it is in the support forums. Is this something we want to document in the Netlify Dev section, or do we want to wait until we have what this issue is proposing (consistent way to override)? And in general, do we want to address gaps like this, or wait until we have a consistent override strategy? |
Thanks @KyleBlankRollins, I think it makes sense to document
I'm not sure, as some gaps might be related to CLI bugs and could be considered as features unintentionally. So I would take this one case as a time. |
When deploying a site on Netlify one can use either the UI or/and a
netlify.toml
file to modify deploy/build related settings.The CLI allows overriding some of those via flags (like functions/publish directory).
Other CLI behaviour is controlled via env variables:
cli/src/utils/open-browser.js
Line 18 in 9ce3a91
I believe we should be consistent in the CLI with how we treat flags, env variables and which part of the configuration can be modified using those.
I suggest using the following conventions:
netlify.toml
and UI (the last two are handled in Netlify conifg package).NETLIFY_
except ones that are meant to be shared by tools (likeBROWSER,HTTP_PROXY
)As for overriding
netlify.toml
/UI settings I personally believe we should provide good defaults and make everything configurable via flags, but that might become cumbersome.Thoughts?
The text was updated successfully, but these errors were encountered: