Replies: 7 comments 20 replies
|
My favorite is option 2. I also like option 1. Then I would suggest: between the two pick the one you consider easier to implement and maintain. I don't like options 3 and 4 and would never use them. I would prefer to externally tweak Although I'm a big Ruby fan (I like ERB also), I feel like Bashly shouldn't look like it favors those who know some Ruby (which we already do here). |
|
Option 2.
There's also an option you may have missed: environment variables. One could pretty easily set Honestly I'd prefer the environment variable approach until it becomes apparent that a lot of people are overriding a lot of settings based on environment. |
|
Interesting. I did not mention the bashly environment variables, since this it is a bypass of the built in Option 2 is much easier to implement. |
|
I also liked the 2nd option, since it’s already familiar to the community given that other technologies implement it as well. I’d also suggest implementing formatter: shfmt # In the global scope; in this case, applied only in development.
production:
formatter: shfmt --minify # Applied only when in production.The 4th option could improve readability, but @meleu’s arguments are undeniable! |
|
Hmm.... I spoke too soon. On paper, loading an additional config file is trivial. However, since the def env
@env ||= get(:env)&.to_sym # <== expecting a fully built config object
end
def config
@config ||= defsult_settings.merge(user_settings).merge(env_settings)
end
def env_settings
@env_settings ||= File.exist?(env_settings_path) ? Config.new(env_settings_path) : {}
end
def env_settings_path
@env_settings_path ||= user_settings_path.sub(/(\.[^.]+)$/, ".#{env}\\1") # <== calling env
end |

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This issue was raised in #664.
Some bashly settings may benefit from having different values based on the bashly environment setting (production / development).
Example use case - use
formatter: shfmt --minifyfor production, andformatter: internalfor development.I am wondering what - if any - is the optimal way to implement this:
Option 1: Allow hash syntax
Option 2: Support settings file per environment
Like in Rails, load settings in this order if the files are found:
settings.ymlsettings.production.yml/settings.development.ymlbased on envOption 3: Do nothing except document the ERB solution styleOption 4: Improve the ERB style by providing more context to the Settings readerOption 5: Allow
_production/_developmentsuffix on all keysImplemented in #668
I am sure there may be some other options.
Finally, if we decide to implement using option 1, then which of the settings deserve such treatment.
target_dir,strict,show_examples_on_error.If anyone has any opinion on the subject, I am interested to hear.
ping: @meleu @pcrockett @mcblum
All reactions