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/properties.md
+57-23
Original file line number
Diff line number
Diff line change
@@ -72,15 +72,33 @@ Even though the engine itself doesn't support property grouping, this can be acc
72
72
73
73
These properties can be accessed via `$property[PURCHASE.SERVICE.DB.URL]` or `$property[INVENTORY.SERVICE.DB.URL]`
74
74
75
-
### Overriding poperties at runtime
75
+
### Overriding properties at runtime
76
+
77
+
In order to override properties at runtime, you have to enable external property resolvers.
78
+
79
+
This can be done by setting the `FLOGO_APP_PROP_RESOLVERS` environment variable. Currently, there are two built-in external
80
+
property resolvers: json(JSON) and env(Environment Variable).
81
+
82
+
83
+
```terminal
84
+
FLOGO_APP_PROP_RESOLVERS=env,json ./<app_binary>
85
+
```
76
86
77
87
You can override app properties at runtime in two ways:
78
88
79
-
#### Using JSON
89
+
#### Resolver: json
90
+
91
+
When using the `json` property resolver, you can provide a comma separated list of json files that
92
+
will override the application's existing property values.
93
+
```env
94
+
FLOGO_APP_PROPS_JSON=app1.json,common.json
95
+
```
80
96
81
-
Define your new value for a given app prop in a json file as shown below:
97
+
**Example**
82
98
83
-
props.json:
99
+
Let's say you want to override some of your properties. You will need to define your new value for a given property in your json file.
100
+
101
+
_props.json_
84
102
85
103
```json
86
104
{
@@ -89,60 +107,76 @@ props.json:
89
107
}
90
108
```
91
109
92
-
Run the application with the environment variable `FLOGO_APP_PROPS_OVERRIDE` set to `props.json`. For example:
110
+
Now run your application:
93
111
94
112
```terminal
95
-
FLOGO_APP_PROPS_OVERRIDE=props.json ./MyApp
113
+
114
+
export FLOGO_APP_PROPS_JSON=props.json
115
+
FLOGO_APP_PROP_RESOLVERS=json ./MyApp
96
116
```
97
-
or
117
+
118
+
#### Resolver: env
119
+
120
+
In order to override properties using environment variables, you just need enable the `env` property resolver
98
121
99
122
```terminal
100
-
export FLOGO_APP_PROPS_OVERRIDE=props.json
101
-
./MyApp
123
+
FLOGO_APP_PROP_RESOLVERS=env ./<app_binary>
102
124
```
103
125
126
+
**Example**
104
127
105
-
#### Using Key/Value pair
106
-
107
-
Run the application with the environment variable `FLOGO_APP_PROPS_OVERRIDE` set to the key/value pairs. For example:
128
+
Let's say you want to override `myprop` property in your app. You would do the following:
108
129
109
130
```terminal
110
-
FLOGO_APP_PROPS_OVERRIDE="MyProp1=This is newvalue,MyProp2=30" ./MyApp
131
+
132
+
export myprop=bar
133
+
FLOGO_APP_PROP_RESOLVERS=env ./MyApp
111
134
```
112
135
113
-
### Working with external configuration management services
114
136
115
-
You can plug-in your proeprty value resolver to resolve application property values from external configuration management services, such as, Consul, Spring Cloud Config etc. Just implement the following interface and register implementation with the runtime:
137
+
### Custom External Resolver
138
+
139
+
You can plug-in your own property resolver to resolve application property values from external configuration management services, such as, Consul, Spring Cloud Config etc. Just implement the following interface and register implementation with the runtime:
116
140
117
141
```go
118
-
// PropertyValueResolver used to resolve value from external configuration like env, file etc
119
-
type PropertyValueResolver interface {
120
-
// Should return value and true if the given application property exists in the external configuration otherwise should return nil and false.
*Note: In order for your resolver to be loaded in the go code, you need to add an entry to your resolver in the imports section of the the engine.json*
176
+
*Note: In order for your resolver to be loaded in the go code, you need to add an entry to your resolver in the imports section of the engine.json*
143
177
144
178
145
-
Set the `FLOGO_APP_PROPS_RESOLVERS` env var to `sampleresolver` while running application. For example:
179
+
Set the `FLOGO_APP_PROP_RESOLVERS` environment variable to `sampleresolver` while running your application. For example:
0 commit comments