Skip to content

Commit be22a1c

Browse files
committed
chore: unify naming of environment variables
1 parent 22e4eb0 commit be22a1c

File tree

15 files changed

+40
-43
lines changed

15 files changed

+40
-43
lines changed

app.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
"description": "The domains supported for CORS requests. All domains are allowed by default. If there are multiple domains, please separate them with commas.",
2828
"required": false
2929
},
30-
"MONGODB_URI": {
31-
"description": "Your Mongo Database URI.",
30+
"MONGODB_URL": {
31+
"description": "Your Mongo Database URL.",
3232
"required": false
3333
},
3434
"REDIS_URL": {

deploy/docker/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@ Image can be configured by setting environment variables.
3030
| `FRONTEND_ENABLED` | If **true** lowcoder web frontend is started in the container | `true` |
3131
| `PUID` | ID of user running services. It will own all created logs and data. | `9001` |
3232
| `PGID` | ID of group of the user running services. | `9001` |
33-
| `MONGODB_URI` | Mongo database connection string | `mongodb://localhost:27017/lowcoder?authSource=admin` |
33+
| `MONGODB_URL` | Mongo database connection string | `mongodb://localhost:27017/lowcoder?authSource=admin` |
3434
| `REDIS_URL` | Redis server URL | `redis://localhost:6379` |
35-
| `JS_EXECUTOR_URI` | Node service URL | `http://localhost:6060` |
3635
| `ENABLE_USER_SIGN_UP` | Enable registration of new users | `true` |
3736
| `ENCRYPTION_PASSWORD` | Encryption password | `lowcoder.org` |
3837
| `ENCRYPTION_SALT` | Salt used for encrypting password | `lowcoder.org` |
@@ -66,9 +65,8 @@ Image can be configured by setting environment variables.
6665
| --------------------------------| --------------------------------------------------------------------| ------------------------------------------------------|
6766
| `PUID` | ID of user running services. It will own all created logs and data. | `9001` |
6867
| `PGID` | ID of group of the user running services. | `9001` |
69-
| `MONGODB_URI` | Mongo database connection string | `mongodb://localhost:27017/lowcoder?authSource=admin` |
68+
| `MONGODB_URL` | Mongo database connection string | `mongodb://localhost:27017/lowcoder?authSource=admin` |
7069
| `REDIS_URL` | Redis server URL | `redis://localhost:6379` |
71-
| `JS_EXECUTOR_URI` | Node service URL | `http://localhost:6060` |
7270
| `ENABLE_USER_SIGN_UP` | Enable registration of new users | `true` |
7371
| `ENCRYPTION_PASSWORD` | Encryption password | `lowcoder.org` |
7472
| `ENCRYPTION_SALT` | Salt used for encrypting password | `lowcoder.org` |

deploy/docker/docker-compose-multi.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ services:
3333
environment:
3434
PUID: "9001"
3535
PGID: "9001"
36-
MONGODB_URI: "mongodb://lowcoder:secret123@mongodb/lowcoder?authSource=admin"
36+
MONGODB_URL: "mongodb://lowcoder:secret123@mongodb/lowcoder?authSource=admin"
3737
REDIS_URL: "redis://redis:6379"
38-
JS_EXECUTOR_URI: "http://lowcoder-node-service:6060"
38+
LOWCODER_NODE_SERVICE_URL: "http://lowcoder-node-service:6060"
3939
ENABLE_USER_SIGN_UP: "true"
4040
ENCRYPTION_PASSWORD: "lowcoder.org"
4141
ENCRYPTION_SALT: "lowcoder.org"

deploy/docker/docker-compose.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ services:
2525
DEFAULT_ORG_GROUP_COUNT: 100
2626
DEFAULT_ORG_APP_COUNT: 1000
2727
DEFAULT_DEVELOPER_COUNT: 50
28-
#MONGODB_URI: "mongodb://lowcoder:secret123@mongodb/lowcoder?authSource=admin"
29-
MONGODB_URI: "mongodb://localhost:27017/lowcoder?authSource=admin"
28+
#MONGODB_URL: "mongodb://lowcoder:secret123@mongodb/lowcoder?authSource=admin"
29+
MONGODB_URL: "mongodb://localhost:27017/lowcoder?authSource=admin"
3030
REDIS_URL: "redis://localhost:6379"
31-
JS_EXECUTOR_URI: "http://localhost:6060"
3231
ENABLE_USER_SIGN_UP: "true"
3332
ENCRYPTION_PASSWORD: "lowcoder.org"
3433
ENCRYPTION_SALT: "lowcoder.org"

deploy/helm/templates/api-service/configMap.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ data:
1818
REDIS_URL: {{- .Values.redis.externalUrl | quote }}
1919
{{- end }}
2020
{{- if .Values.apiService.nodeServiceUrl }}
21-
JS_EXECUTOR_URI: {{ .Values.apiService.nodeServiceUrl | quote }}
21+
LOWCODER_NODE_SERVICE_URL: {{ .Values.apiService.nodeServiceUrl | quote }}
2222
{{- else }}
23-
JS_EXECUTOR_URI: "http://{{ $name }}-node-service:{{ .Values.nodeService.service.port }}"
23+
LOWCODER_NODE_SERVICE_URL: "http://{{ $name }}-node-service:{{ .Values.nodeService.service.port }}"
2424
{{- end }}
2525
PUID: {{ .Values.apiService.config.userId | default "9001" | quote }}
2626
PGID: {{ .Values.apiService.config.groupId | default "9001" | quote }}

deploy/helm/templates/api-service/secrets.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ metadata:
1616
{{- end }}
1717
stringData:
1818
{{- if .Values.mongodb.enabled }}
19-
MONGODB_URI: "mongodb://{{ $mongoUser }}:{{ $mongoPassword }}@{{ $mongoServicename }}.{{ $nameSpace }}.svc.cluster.local/{{ $lowcoderDatabase }}?retryWrites=true&ssl=false"
19+
MONGODB_URL: "mongodb://{{ $mongoUser }}:{{ $mongoPassword }}@{{ $mongoServicename }}.{{ $nameSpace }}.svc.cluster.local/{{ $lowcoderDatabase }}?retryWrites=true&ssl=false"
2020
{{- else }}
21-
MONGODB_URI: {{- .Values.mongodb.externalUrl | quote }}
21+
MONGODB_URL: {{- .Values.mongodb.externalUrl | quote }}
2222
{{- end }}
2323
ENCRYPTION_PASSWORD: {{ .Values.apiService.config.encryption.password | default "lowcoder.org" | quote }}
2424
ENCRYPTION_SALT: {{ .Values.apiService.config.encryption.salt | default "lowcoder.org" | quote }}

docs/self-hosting/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ For developers who require stateless containers in a cluster environment, we off
136136

137137
<figure><img src="../.gitbook/assets/docker-compose-multi.jpeg" alt=""><figcaption></figcaption></figure>
138138

139-
* **mongodb**: Start a new MongoDB instance on your host. You can delete this part and modify the environment variable `MONGODB_URI` of **openblocks-api-service** to use your own MongoDB.
140-
* **redis**: Start a new Redis instance on your host. You can delete this part and modify the environment variable `REDIS_URI` of **openblocks-api-service** to use your own Redis.
139+
* **mongodb**: Start a new MongoDB instance on your host. You can delete this part and modify the environment variable `MONGODB_URL` of **openblocks-api-service** to use your own MongoDB.
140+
* **redis**: Start a new Redis instance on your host. You can delete this part and modify the environment variable `REDIS_URL` of **openblocks-api-service** to use your own Redis.
141141
* **openblocks-api-service**: Required.&#x20;
142142
* **openblocks-node-service**: Required.
143143
* **openblocks-frontend**: Required. Can be optional if you deploy frontend on CDN.
@@ -199,16 +199,16 @@ By default Lowcoder uses the built-in MongoDB and Redis installed inside the con
199199

200200
{% tabs %}
201201
{% tab title="Docker-Compose" %}
202-
Add environment variables `MONGODB_URI` and `REDIS_URI` in `docker-compose.yml` downloaded in your working directory.\
202+
Add environment variables `MONGODB_URL` and `REDIS_URL` in `docker-compose.yml` downloaded in your working directory.\
203203
<img src="../.gitbook/assets/mongodb-redis-uri.png" alt="" data-size="original">
204204
{% endtab %}
205205

206206
{% tab title="Docker" %}
207-
Add environment variables `MONGODB_URI` and `REDIS_URI` to the deployment command, as shown below:
207+
Add environment variables `MONGODB_URL` and `REDIS_URL` to the deployment command, as shown below:
208208

209209
{% code overflow="wrap" %}
210210
```bash
211-
docker run -d --name openblocks -e MONGODB_URI=YOUR_MONGODB_URI REDIS_URI=YOUR_REDIS_URI -p 3000:3000 -v "$PWD/stacks:/openblocks-stacks lowcoderorg/lowcoder-ce
211+
docker run -d --name openblocks -e MONGODB_URL=YOUR_MONGODB_URL REDIS_URL=YOUR_REDIS_URL -p 3000:3000 -v "$PWD/stacks:/openblocks-stacks lowcoderorg/lowcoder-ce
212212
```
213213
{% endcode %}
214214
{% endtab %}

server/api-service/lowcoder-plugins/mongoPlugin/src/main/java/org/lowcoder/plugin/mongo/MongoPlugin.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -344,13 +344,13 @@ private String buildClientUri(MongoDatasourceConfig mongoDatasourceConfig) {
344344

345345
if (mongoDatasourceConfig.isUsingUri()) {
346346
if (StringUtils.isBlank(mongoDatasourceConfig.getUri())) {
347-
throw new PluginException(DATASOURCE_ARGUMENT_ERROR, "MONGODB_URI_EMPTY");
347+
throw new PluginException(DATASOURCE_ARGUMENT_ERROR, "MONGODB_URL_EMPTY");
348348
}
349349

350350
String uri = mongoDatasourceConfig.getUri();
351351
Map<String, String> extractedInfo = extractInfoFromConnectionStringURI(uri);
352352
if (extractedInfo == null) {
353-
throw new PluginException(DATASOURCE_ARGUMENT_ERROR, "MONGODB_URI_EXTRACT_ERROR");
353+
throw new PluginException(DATASOURCE_ARGUMENT_ERROR, "MONGODB_URL_EXTRACT_ERROR");
354354
}
355355

356356
return uri;
@@ -420,17 +420,17 @@ public Set<String> validateConfig(MongoDatasourceConfig connectionConfig) {
420420

421421
if (connectionConfig.isUsingUri()) {
422422
if (StringUtils.isBlank(connectionConfig.getUri())) {
423-
return ImmutableSet.of("MONGODB_URI_EMPTY_PLZ_CHECK");
423+
return ImmutableSet.of("MONGODB_URL_EMPTY_PLZ_CHECK");
424424
}
425425

426426
String mongoUri = connectionConfig.getUri();
427427
if (!MongoConnectionUriParser.isValid(mongoUri)) {
428-
return ImmutableSet.of("INVALID_MONGODB_URI_PLZ_CHECK");
428+
return ImmutableSet.of("INVALID_MONGODB_URL_PLZ_CHECK");
429429
}
430430

431431
Map<String, String> extractedInfo = extractInfoFromConnectionStringURI(mongoUri);
432432
if (extractedInfo == null) {
433-
return ImmutableSet.of("INVALID_MONGODB_URI_PLZ_CHECK");
433+
return ImmutableSet.of("INVALID_MONGODB_URL_PLZ_CHECK");
434434
}
435435

436436
return invalids;

server/api-service/lowcoder-plugins/mongoPlugin/src/main/java/org/lowcoder/plugin/mongo/model/MongoConnectionUriParser.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ public final class MongoConnectionUriParser {
2020
*
2121
* ^(mongodb(?:\+srv)?:\/\/)(?:(.+):(.+)@)?([^\/\?]+)\/?([^\?]+)?\??(.+)?$
2222
*/
23-
public static final String MONGO_URI_REGEX = "^(mongodb(?:\\+srv)?://)(?:(.+):(.+)@)?([^/?]+)/?([^?]+)?\\??(.+)?$";
23+
public static final String MONGO_URL_REGEX = "^(mongodb(?:\\+srv)?://)(?:(.+):(.+)@)?([^/?]+)/?([^?]+)?\\??(.+)?$";
2424

25-
private static final Pattern PATTERN = Pattern.compile(MONGO_URI_REGEX);
25+
private static final Pattern PATTERN = Pattern.compile(MONGO_URL_REGEX);
2626

2727
private static final int REGEX_GROUP_HEAD = 1;
2828

@@ -53,7 +53,7 @@ public static boolean isValid(String uri) {
5353
}
5454

5555
public static Map<String, String> extractInfoFromConnectionStringURI(String uri) {
56-
if (!uri.matches(MONGO_URI_REGEX)) {
56+
if (!uri.matches(MONGO_URL_REGEX)) {
5757
return null;
5858
}
5959

@@ -75,7 +75,7 @@ public static Map<String, String> extractInfoFromConnectionStringURI(String uri)
7575
public static String parseDatabaseFrom(String uri) {
7676
Map<String, String> extractedInfo = extractInfoFromConnectionStringURI(uri);
7777
if (extractedInfo == null) {
78-
throw ofPluginException(DATASOURCE_ARGUMENT_ERROR, "INVALID_MONGODB_URI");
78+
throw ofPluginException(DATASOURCE_ARGUMENT_ERROR, "INVALID_MONGODB_URL");
7979
}
8080

8181
String database = extractedInfo.get(KEY_URI_DBNAME);

server/api-service/lowcoder-plugins/redisPlugin/src/main/java/org/lowcoder/plugin/redis/RedisError.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public enum RedisError implements PluginError {
77
// redis
88
REDIS_EXECUTION_ERROR,
99

10-
REDIS_URI_ERROR,
10+
REDIS_URL_ERROR,
1111

1212

1313
}

0 commit comments

Comments
 (0)