You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
allow user to specify default value when using store (cloudposse#1020)
* allow user to specify default value when using store
* Update internal/exec/yaml_func_store_test.go
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* allow user to specify default value when using store
---------
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
u.LogErrorAndExit(fmt.Errorf("an error occurred while looking up key %s in stack %s and component %s from store %s\n%v", params.key, params.stack, params.component, params.storeName, err))
77
+
ifretParams.defaultValue!=nil {
78
+
return*retParams.defaultValue
79
+
}
80
+
u.LogErrorAndExit(fmt.Errorf("failed to get key: %s", err))
Copy file name to clipboardExpand all lines: website/docs/core-concepts/stacks/yaml-functions/store.mdx
+8-2Lines changed: 8 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -9,20 +9,23 @@ import Intro from '@site/src/components/Intro'
9
9
importTerminalfrom'@site/src/components/Terminal'
10
10
11
11
<Intro>
12
-
The `!store` YAML function allows reading the values from a remote [store](/core-concepts/projects/configuration/stores) (e.g. SSM Parameter Store, Artifactory, etc.)
12
+
The `!store` YAML function allows reading the values from a remote [store](/core-concepts/projects/configuration/stores) (e.g. SSM Parameter Store, Artifactory, Redis, etc.)
13
13
into Atmos stack manifests.
14
14
</Intro>
15
15
16
16
## Usage
17
17
18
-
The `!store` function can be called with either two or three parameters:
18
+
The `!store` function can be called with either two or three parameters, and optionally a default value:
19
19
20
20
```yaml
21
21
# Get the `key` from the store of a `component` in the current stack
22
22
!store <component> <key>
23
23
24
24
# Get the `key` from the store of a `component` in a different stack
25
25
!store <component> <stack> <key>
26
+
27
+
# Get the `key` from the store of a `component` in a different stack, with a default value
0 commit comments