how to reference a YAML “setting” from elsewhere in the same YAML file?

I have the following YAML: paths: patha: /path/to/root/a pathb: /path/to/root/b pathc: /path/to/root/c How can I “normalise” this, by removing /path/to/root/ from the three paths, and have it as its own setting, something like: paths: root: /path/to/root/ patha: *root* + a pathb: *root* + b pathc: *root* + c Obviously that’s invalid, I just made it … Read more

YAML Multi-Line Arrays

In YAML, you can easily create multi-line strings. However, I would like the ability to create a multi-line array (mainly for readibility within config files) using the | character. A YAML array can be represented as: [‘key1’, ‘key2’, ‘key3’]. A YAML sequence uses a dash followed by a space and then a string: – String1 … Read more

What do the &,

Up until now I have only used database.yml with each parameter called out explicitly, in the file below it uses some characters I do not understand. What does each line and symbol(&, *, <<) mean? How do I read this file? development: &default adapter: postgresql database: dev_development test: &test <<: *default database: test_test cucumber: <<: … Read more

What is the difference between .yaml and .yml extension? [duplicate]

This question already has answers here: Is it .yaml or .yml? (4 answers) Closed 3 years ago. I read them on YAML-wikipedia but not really understood the main difference between them. I saw there are someone using .yaml extension, however, Symfony2 use .yml extension. YAML is a human-readable data serialization format that takes concepts from … Read more

How do I parse a YAML file in Ruby?

I would like to know how to parse a YAML file with the following contents: — javascripts: – fo_global: – lazyload-min – holla-min Currently I am trying to parse it this way: @custom_asset_packages_yml = (File.exists?(“#{RAILS_ROOT}/config/asset_packages.yml”) ? YAML.load_file(“#{RAILS_ROOT}/config/asset_packages.yml”) : nil) if !@custom_asset_packages_yml.nil? @custom_asset_packages_yml[‘javascripts’].each{ |js| js[‘fo_global’].each{ |script| script } } end But it doesn’t seem to work … Read more

why — (3 dashes/hyphen) in yaml file?

So I just started using YAML file instead of application.properties as it is more readable. I see in YAML files they start with —. I googled and found the below explanation. YAML uses three dashes (“—”) to separate directives from document content. This also serves to signal the start of a document if no directives … Read more

Setting active profile and config location from command line in spring boot

I have a spring boot application. I have three profiles in my application-> development, staging and production. So I have 3 files application-development.yml application-staging.yml application-production.yml My application.yml resides inside src/main/resources. I have set the active profile in application.yml as : spring: profiles.active: development The other 3 profile specific config files are present in C:\config folder. … Read more