ruby - Optimizating application.yml file in rails application -


i have constants in application.yml file using in application @ different places.

example ( in config/application.yml)

 main_url : "http://abc.net/api"      a_url: "http://abc.net/api/a"      b_url: "http://abc.net/api/b"      c_url: "http://abc.net/api/c" 

looking code url "http://abc.net/api" repeating @ every place. want remove repeating url , use main_url + rest url combination. how in application.yml want application.yml should

main_url : "http://abc.net/api"      a_url: main_url + "/a"      b_url: main_url + "/b"      c_url: main_url + "/c" 

what best way remove repeated code configuration yaml file.

i don't think possible. can reuse "node" not part of it.

bill-to: &id001     given  : chris     family : dumars ship-to: *id001 

this valid yaml , fields given , family reused in ship-to block. can reuse scalar node same way there's no way can change what's inside , add last part of path inside yaml.

if repetition bother suggest make application aware of root property , add every path looks relative not absolute.

source: how reference yaml "setting" elsewhere in same yaml file?


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -