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

Better behavior when no configuration file is found #502

Closed
ehmicky opened this issue Nov 21, 2019 · 11 comments
Closed

Better behavior when no configuration file is found #502

ehmicky opened this issue Nov 21, 2019 · 11 comments
Labels

Comments

@ehmicky
Copy link
Contributor

ehmicky commented Nov 21, 2019

Follow-up on #497.

Using a configuration file is optional. As such, the configuration defaults to an empty object when no configuration file is found. No exceptions are thrown.

Please note:

  • when no configuration file is found, we do print some message indicating no configuration file was found.
  • when a --config path was explicitly specified, we do throw an error if it cannot be found

However it might be possible that no configuration files might have been found due to wrong user configuration. The only way I can think of would be when the configuration file was saved under a wrong filename. We could use Levenshtein distance or similar approach to try to guess when this happens, in order to print an error message.

@jlengstorf
Copy link
Contributor

I would just print a notice:

NOTICE: No config file found. Using default settings. For more info: <link>

That way we're not guessing (that could bite us), but we're making it clear that their settings aren't being picked up.

Could also be good to notify where the config came from:

Reading config from `/netlify.toml`. Any settings not declared will use the defaults. For more info: <link>

@ehmicky
Copy link
Contributor Author

ehmicky commented Dec 3, 2019

This should already be the current behavior:

  • when no configuration file is found, we print a similar notice
  • when a configuration file is found, we print its location

Do you think this is enough? If so, I can close this issue.

@jlengstorf
Copy link
Contributor

Do we have docs on how config works (e.g. do defaults get inherited? is that consistent across .toml/.yml/Netlify dev?)? if so, I'd love to see those linked from the notice.

If not, maybe that's a new issue?

@DavidWells
Copy link
Contributor

@jlengstorf the values in the config file take precedence, if required values are missing they are inherited from the site settings from the UI

@DavidWells
Copy link
Contributor

Netlify dev doesn't read json/yml yet. It will once this is merged in a day or so netlify/cli#616

@jlengstorf
Copy link
Contributor

@DavidWells I don't think that's universally true. For example setting any config in the dev section causes dev to break without all options being set (as far as I can tell; lots of port errors).

Either way, it would be good to link people to the docs where we explain this so they can learn for themselves how config is managed.

@DavidWells
Copy link
Contributor

DavidWells commented Dec 5, 2019

For example setting any config in the dev section causes dev to break without all options being set (as far as I can tell; lots of port errors).

This sounds like a dev error in the CLI. There is a-lot of confusion around the netlify dev settings and ports in general netlify/cli#563. If you have ideas to make netlify dev and it's related configuration please let me know 😃

@ehmicky
Copy link
Contributor Author

ehmicky commented Dec 5, 2019

@jlengstorf @DavidWells Should this issue be closed?

@jlengstorf
Copy link
Contributor

Personally, I wouldn't close this until there are links to docs in the warnings and/or an issue is open to create clearer docs around defaults and config composition.

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had activity in 1 year. It will be closed in 14 days if no further activity occurs. Thanks!

@github-actions github-actions bot added the stale label Oct 13, 2022
@github-actions
Copy link
Contributor

This issue was closed because it had no activity for over 1 year.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants