Variable Resolution
myna uses a powerful variable substitution system allowing you to parameterize your actions.
Resolution Hierarchy
Section titled “Resolution Hierarchy”When a variable like {{MY_VAR}} is encountered, myna looks for its value in the following order (Highest to Lowest Priority):
- Action
[pre]: Variables defined in the action file itself. - Collection
[pre]: Variables defined inmyna.toml. - Environment
[pre]: Variables defined inenvironments/<env>.toml.
Example
Section titled “Example”Action (action.toml):
[pre]TIMEOUT = 500Collection (myna.toml):
[pre]TIMEOUT = 1000REGION = "us-east-1"Environment (dev.toml):
[pre]REGION = "eu-west-1"STAGE = "dev"Resulting Values:
TIMEOUT: 500 (Action overrides Collection)REGION: “us-east-1” (Collection overrides Environment)STAGE: “dev” (From Environment)
Syntax
Section titled “Syntax”Handlebars {{VAR}}
Section titled “Handlebars {{VAR}}”Used inside string values (like payload.data or function_name). This is a direct text replacement.
[payload]data = """{ "id": "{{USER_ID}}"}"""Shell Style ${VAR}
Section titled “Shell Style ${VAR}”Used mostly when defining variables in TOML tables to reference other variables available at that time/level.
Missing Variables
Section titled “Missing Variables”If a variable is referenced but not found in any of the 3 scopes, myna will:
- Log a warning to the console.
- Leave the template string as-is (e.g.,
{{MISSING_VAR}}).