Skip to content

Input directory

Gregory Nickonov edited this page Apr 8, 2019 · 2 revisions

Input directory is where all the sources for Sunstone are located. There are two types of files that have a special meaning in Sunstone:

  • Value files contain values hierarchy that can be later used to tune resource manifests generation
  • Component files contains component definitions as well as helpers and resource initializers

Input directory is passed to the Sunstone through the command line. If no input directory is specified, then the current working directory will be used.

Value files

These are normal YAML files. File with name values.yaml, located in the input directory, is loaded by default, other files must be specified by -f <file name> command line options. The order of files matters, since the content of each file is merged with the content of previous files, overriding the values at the same paths.

Value file can have a special key $include that contains a name of file or array of file names to include after the current file will be processed. File names are treated as relative to the directory of the file, that contains $include key. Here are two examples of using $include key:

$include: file.yaml
$include:
  - file1.yaml
  - file2.yaml

Component files

Component files are Ruby scripts with the file extension 'rb', such as backend.rb or _macros.rb. Component files are recursively loaded from components subdirectory of the input directory. There is a special order of loading component files that should be taken into account when planning the layout of the components subdirectory. Imagine the following directory structure:

<input directory>
  |- components/
     |- a/
     |  |- _a.rb
     |  |- a.rb
     |- b/
     |  |- c/
     |  |  |- c.rb
     |  |- b.rb
     |- _d.rb
     |- d.rb

Files from this directory will be processed in the following order: _d.rb, d.rb, _a.rb, a.rb, b.rb, c.rb.

Clone this wiki locally