conf_leap

Intro

There are several configuration leaps used by proto_code.

Essentially, going through all the conf leaps is the way to load all the config info.

Filesystem layout: configuration leaps

protoprimer supports any filesystem layout for client repos.

To discover the config files within the filesystem, it uses the concept of "config leap" - see:

./prime config
        graph TD;
    conf_input["`conf_input`"]
    conf_primer["`conf_primer`"];
    conf_client["`conf_client`"];
    conf_env["`conf_env`"];
    conf_derived["`conf_derived`"]

    conf_input -- "`./cmd/proto_code`" --> conf_primer;
    conf_primer -- "`./gconf`" --> conf_client;
    conf_client -- "`./lconf`" --> conf_env;
    conf_env --> conf_derived;

    invis_L1_S2[ ];
    invis_L1_S3[ ];

    invis_L2_S1[ ];
    invis_L2_S3[ ];

    invis_L3_S1[ ];
    invis_L3_S2[ ];

    conf_primer ~~~ invis_L1_S2;
    invis_L1_S2 ~~~ invis_L1_S3;

    invis_L2_S1 ~~~ conf_client;
    conf_client ~~~ invis_L2_S3;

    invis_L3_S1 ~~~ invis_L3_S2;
    invis_L3_S2 ~~~ conf_env;

    style conf_input fill:none;
    style conf_derived fill:none;

    style invis_L1_S2 fill:none,stroke:none;
    style invis_L1_S3 fill:none,stroke:none;

    style invis_L2_S1 fill:none,stroke:none;
    style invis_L2_S3 fill:none,stroke:none;

    style invis_L3_S1 fill:none,stroke:none;
    style invis_L3_S2 fill:none,stroke:none;
    
  • leap_input: not a file - represents data available to the process (env vars, CLI args, etc.)

  • leap_primer: allows "proto code" to find the client repo "global config"

  • leap_client: provides "global config" and allows finding the target env "local config"

  • leap_env: provides "local config"

  • leap_derived: not a file - represents effective config data derived from all the other data

Ordering

Information from the prev leap specifies how to find the next one.

Configuration leaps are ordered (from first to last).

  • leap_input

    This info is provided before path to the file with proto_conf is found.

    It may only from command line args, env vars, or hard-coded values.

    See shebang_line.

  • leap_primer

    This is provided by proto_conf.

  • leap_client

    This leap provides client-specific configurations.

  • leap_env

    This leap provides environment-specific configurations.

    It only makes sense to distinguish leap_env from leap_client when there are more than one environment client code needs to deal with.

    This is also the leap that gives access to source_local config. See also global_vs_local.

  • leap_derived

    This is effective configuration that applies overrides of leap_client field values by leap_env ones.

    See derived_config.

Configuration files

Depending on the env_layout, all configuration leaps may be provided in a single file or separate ones.