Per-profile schema files
RJ opened this issue · comments
I have three main profiles in my rebar.config: production, enterprise, and dev.
Although they share about 80% of the config settings, each profile needs a different set of defaults for the other ~20% of config keys.
For example, dev logs more verbosely, enterprise enables additional authentication modules, etc.
Seems that a nice way to solve this, while keeping the defaults in schema files, would be to include an additional profile-specific .schema file. I don't think this is possible at the mo.
Would it make sense to have an "extra_schema_files" setting? something like this:
{profiles, [
{dev, [
...
{cuttlefish, [
{extra_schema_files, [
"profile_schemas/dev_defaults.schema"
]}
]}
...
]}
]}.
Any files specified like that could be added on the end of the list of schema files from here: https://github.com/tsloughter/rebar3_cuttlefish/blob/master/src/rebar3_cuttlefish_release.erl#L119
Can't you just have them in the overlays
within the relx
config section in a profile?
Yes, for some reason that didn't occur to me.. this works fine:
{overlay, [
{template, "schema/profiles/dev.schema", "share/schema/99-dev.schema"}
]}
Although it exposes the paths where schemas end up in the release, it's less hassle for the time being. I have a branch of this repo with an extra_schema_files option, but won't be using it for now.
I have to use the same destination filename for each profile, since existing schema files aren't removed when building as a different profile, ie:
{template, "schema/profiles/dev.schema", "share/schema/99-PROFILE.schema"}
...
{template, "schema/profiles/prod.schema", "share/schema/99-PROFILE.schema"}
...
{template, "schema/profiles/enterprise.schema", "share/schema/99-PROFILE.schema"}
otherwise building as dev, then doing a build as another profile without clearing _build will end up including the dev-specific schema file too.