What type of feature request is this?
- [ ] Mantle doesn't support a Roblox feature I would like to use
- [ ] Mantle CLI improvement
- [X] Mantle config improvement
- [ ] Other
Describe your problem
The current environment overrides configuration options are limited and require lots of boilerplate which makes it harder to read.
The targetOverrides
provides full flexibility at the cost of making it hard to add simple things and by reducing DRYness. As a result, the targetNamePrefix
and targetAccess
properties were added as shorthands to targetOverrides
modifications. This is not a scalable approach to the config format.
Describe the solution you'd like
Switch to a variable-based approach, where Mantle provides a simple variable expansion to the user's config. Mantle will provide a set of default variables (like environmentLabel
) and will allow the user to define their own variables per environment via a variables
dictionary property on the environment object.
environments:
- label: dev
variables:
environmentPostfix: ' - Development'
playability: public
- label: prod
variables:
environmentPostfix: ''
playability:
target:
experience:
configuration:
playability: $playability
places:
start:
configuration:
name: My Game$environmentPostfix
In order for this to work we would need to perform the variable expansion before parsing the config with serde. To do this we could do an initial parse of just the environments
property (without any expansion), expand variables on the whole file's contents, then parse with serde.
To make this more useful and powerful we could also allow some simple expressions:
target:
experience:
places:
start:
configuration:
name: My Game${ if(ne($environmentLabel, 'prod'), concat(' [', upper($environmentLabel), ']')) }
name: My Game${ if $environmentLabel != 'prod' then ' [$environmentLabel]' }
enhancement next