palkan / anyway_config

Configuration library for Ruby gems and applications
MIT License
778 stars 52 forks source link

Allow the (undocumented) setting `.default_config_path` to accept just a directory name instead of a callable #64

Closed Goddesen closed 4 years ago

Goddesen commented 4 years ago

Is your feature request related to a problem? Please describe.

It was not immediately obvious to me that .default_config_path needs a callable. I just happened to come across this setting in the code; it does not seem to exist in the readme (the readme only mentions the environment override).

Describe the solution you'd like

I propose that this setting be converted to just represent the directory containing the config files and that the .yml file extension be assumed. Alternately, the setting can be either a string (or Pathname) or a lambda, and the lambda be used only if the setting responds to .call. This also takes care of the use case where a user might want a file extension other than .yml.

Additionally, this setting should be documented in the readme.

Describe alternatives you've considered

Setting the attribute to be a lambda works just fine, but it feels very implementation reliant.

Additional context

I would be happy to create a pull request with the implementation for this.

palkan commented 4 years ago

I would be happy to create a pull request with the implementation for this.

Oops, sorry, just noticed that. Next time feel free to propose a PR right away)

Goddesen commented 4 years ago

Hehe thanks I'll do that.