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). |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
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! |
Beta Was this translation helpful? Give feedback.
-
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 |
Beta Was this translation helpful? Give feedback.
-
I have added Option 5: formatter: shfmt
formatter_production: shfmt --minify The suffix can be any environment, and on any option. Easy to implement, document, and use. Thoughts? |
Beta Was this translation helpful? Give feedback.
-
@meleu - this looks cool, shouldn't we link from the wiki? |
Beta Was this translation helpful? Give feedback.
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 --minify
for production, andformatter: internal
for 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.yml
settings.production.yml
/settings.development.yml
based 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
/_development
suffix 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
Beta Was this translation helpful? Give feedback.
All reactions