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
Copy file name to clipboardExpand all lines: docs/pages/configuration/expressions.mdx
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -129,6 +129,17 @@ Expressions are run in a golang shell that is syntax compatible to a regular POS
129
129
Variables are resolved before and after applying expressions, which means that you can load a section from file within an expression that contains a variable which will still be resolved afterwards.
130
130
:::
131
131
132
+
:::warning Unsupported Config Expressions
133
+
Expressions are not supported in these configuration properties:
134
+
- `vars`
135
+
- `profiles[*].name`
136
+
- `profiles[*].parent`
137
+
- `profiles[*].parents`
138
+
- `profiles[*].activations`
139
+
- `profiles[*].patches[*].op`
140
+
- `profiles[*].patches[*].path`
141
+
:::
142
+
132
143
### Testing Config Expressions
133
144
134
145
The command `devspace print` can be used to test your config expressions and shows the config after all profiles, variables and expressions were applied.
Copy file name to clipboardExpand all lines: docs/pages/configuration/profiles/activation.mdx
+31-8Lines changed: 31 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,9 +3,27 @@ title: "Profiles: Activation"
3
3
sidebar_label: activation
4
4
---
5
5
6
-
The `activation` option is optional and allows you to activate a profile using regular expression matching of environment variables. An activation is configured with the profile it activates in `devspace.yaml`.
6
+
The `activation` option is optional and allows you to activate a profile using regular expression matching of either Devspace or environment variables. An activation is configured with the profile it activates in `devspace.yaml`.
7
7
8
-
#### Example: Defining a Profile Activation
8
+
9
+
#### Example: Defining a Profile Activation using `vars`
10
+
```yaml {1-3,7-8}
11
+
vars:
12
+
- name: ENV
13
+
default: development
14
+
profiles:
15
+
- name: production
16
+
activation:
17
+
- vars:
18
+
ENV: production
19
+
patches:
20
+
- op: replace
21
+
path: images.backend.image
22
+
value: john/prodbackend
23
+
```
24
+
The `production` profile would be activated when the Devspace variable `ENV` has value `production`. In this example, it has a default value of `development`, so it is not activated unless you override the value using `--var ENV=production`
25
+
26
+
#### Example: Defining a Profile Activation using Environment Variables
9
27
```yaml {3-5}
10
28
profiles:
11
29
- name: production
@@ -33,30 +51,35 @@ profiles:
33
51
```
34
52
The profile `production` would be activated when the environment variable `ENV` matches the regular expression `prod-\d+`. This can be useful for matching environment variables that have dynamic values. Regular expressions will have start of string (`^`) and end of string (`$`) anchors added automatically to avoid unexpected substring matching.
35
53
36
-
#### Example: Matching All Environment Variables
37
-
When multiple `env` name/expression pairs are specified in the same activation, all environment variables values must match the expression to activate the profile. For example, the `production` profile is activated when both environment variables match their expressions:
38
-
```yaml {3-6}
54
+
#### Example: Matching All
55
+
When multiple `env` or `vars` name/expression pairs are specified in the same activation, all expressions must match to activate the profile. For example, the `production` profile is activated when the environment variable `CI` is `true` and the Devspace variable `ENV` is `development`:
56
+
```yaml {3-7}
39
57
profiles:
40
58
- name: production
41
59
activation:
42
60
- env:
43
61
CI: "true"
62
+
vars:
44
63
ENV: "development"
45
64
patches:
46
65
- op: replace
47
66
path: images.backend.image
48
67
value: john/devbackend
49
68
```
50
69
51
-
#### Example: Matching Any Environment Variables
52
-
When environment variables are used in multiple activations, the profile is activated when any environment variable matches. In this example, the `production` profile is activated when either environment variables match their expressions:
70
+
:::note Combining `env` and `vars`
71
+
While possible to activate profiles using environment variables and Devspace variables, `vars` can also be populated through environment variables. In the above example, we could have also defined `CI` as a Devspace variable with `source: env` and only used `vars` in the activation.
72
+
:::
73
+
74
+
#### Example: Matching Any
75
+
When `env` or `vars` are used in multiple activations, the profile is activated when any expression matches. In this example, the `production` profile is activated when either match their expressions:
0 commit comments