Skip to content

Commit c640eb6

Browse files
committed
chore: unify naming of environment variables
1 parent 96995c3 commit c640eb6

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
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import static com.google.common.collect.Maps.newHashMap;
2020
import static java.util.Objects.isNull;
2121
import static org.lowcoder.plugin.redis.RedisError.REDIS_EXECUTION_ERROR;
22-
import static org.lowcoder.plugin.redis.RedisError.REDIS_URI_ERROR;
22+
import static org.lowcoder.plugin.redis.RedisError.REDIS_URL_ERROR;
2323
import static org.lowcoder.plugin.redis.constants.RedisConstants.JEDIS_POOL_MAX_IDLE;
2424
import static org.lowcoder.plugin.redis.constants.RedisConstants.JEDIS_POOL_MAX_TOTAL;
2525
import static org.lowcoder.plugin.redis.constants.RedisConstants.JEDIS_POOL_MIN_EVICTABLE_IDLE_MILLIS;
@@ -101,7 +101,7 @@ public Mono<JedisPool> createConnection(RedisDatasourceConfig connectionConfig)
101101
.subscribeOn(scheduler)
102102
.onErrorMap(t -> {
103103
if (t instanceof ArrayIndexOutOfBoundsException && connectionConfig.isUsingUri()) {
104-
return new PluginException(REDIS_URI_ERROR, "REDIS_URI_ERROR", t.getMessage());
104+
return new PluginException(REDIS_URL_ERROR, "REDIS_URL_ERROR", t.getMessage());
105105
}
106106
return t;
107107
});
@@ -173,7 +173,7 @@ public Set<String> validateConfig(RedisDatasourceConfig connectionConfig) {
173173

174174
if (connectionConfig.isUsingUri()) {
175175
if (StringUtils.isBlank(connectionConfig.getUri())) {
176-
invalids.add("REDIS_URI_EMPTY");
176+
invalids.add("REDIS_URL_EMPTY");
177177
}
178178
} else {
179179
if (StringUtils.isBlank(host)) {

server/api-service/lowcoder-sdk/src/main/resources/locale_en.properties

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ NO_PERMISSION_TO_VIEW=It appears you don''t have the permission to view, please
9999
INVALID_QUERY_ID=Invalid query ID.
100100
INVALID_ES_CONFIG=Illegal elasticsearch data source configuration.
101101
INVALID_CONNECTION_STRING=Fail to parse connectionString.
102-
INVALID_MONGODB_URI=Illegal MongoDB URI format, please check again.
102+
INVALID_MONGODB_URL=Illegal MongoDB URL format, please check again.
103103
MONGODB_DATABASE_EMPTY=MongoDB database cannot be empty.
104104
DATASOURCE_NAME_EMPTY=Illegal data source configuration: data source name is empty.
105105
INVALID_DATASOURCE_TYPE_0=Illegal data source type.
@@ -129,7 +129,7 @@ CONNECTION_ERROR=Connection error: {0}.
129129
MONGODB_COMMAND_ERROR=Illegal MongoDB query: {0}
130130
REST_API_EXECUTION_ERROR=REST API execution error: {0}.
131131
REDIS_EXECUTION_ERROR=Sorry, Redis execution error: {0}.
132-
REDIS_URI_ERROR=The format of the URI error: {0}. Correct format: redis://username:password@my-redis.com: 6379 or redis://:password@my-redis.com: 6379.
132+
REDIS_URL_ERROR=The format of the URL error: {0}. Correct format: redis://username:password@my-redis.com: 6379 or redis://:password@my-redis.com: 6379.
133133
LOWCODER_INTERNAL_REQUEST_ERROR=Request failed: {0}.
134134
LOWCODER_INTERNAL_INVALID_REQUEST_TYPE=Invalid Lowcoder API request type, please contact the administrator.
135135
ES_EXECUTION_ERROR=Elasticsearch query execution error: {0}.
@@ -174,8 +174,8 @@ INVALID_PG_QUERY_CONFIG_EMPTY=PostgreSQL query configuration is empty.
174174
INVALID_PG=Failed to parse PostgreSQL query configuration.
175175
INVALID_RESTAPI=Failed to parse REST API query configuration.
176176
GET_MONGODB_STRUCTURE_ERROR=Failed to get MongoDB structure.
177-
MONGODB_URI_EMPTY=MongoDB''s connection URI is empty.
178-
MONGODB_URI_EXTRACT_ERROR=Failed to resolve MongoDB connection URI.
177+
MONGODB_URL_EMPTY=MongoDB''s connection URL is empty.
178+
MONGODB_URL_EXTRACT_ERROR=Failed to resolve MongoDB connection URL.
179179
CONTENT_PARSE_ERROR=Resolve upload data failed, it requires format {data:base64 string, name:string} or an array of it
180180
MULTIFORM_DATA_IS_NOT_STRING=Resolve upload data failed, data field is not a valid base64 string
181181
MULTIFORM_NAME_IS_NOT_STRING=Resolve upload data failed, name field is not a valid string
@@ -210,11 +210,11 @@ HOST_WITH_COLON=Host cannot contain "/" or ":" character.
210210
INVALID_HOST=Invalid Host.
211211
DATABASE_NAME_EMPTY=Database name cannot be empty.
212212
CONNECTION_STRING_EMPTY=The connection string cannot be empty.
213-
MONGODB_URI_EMPTY_PLZ_CHECK=URI format of the connection is invalid.
214-
INVALID_MONGODB_URI_PLZ_CHECK=URI format of the MongoDB connection is invalid.
213+
MONGODB_URL_EMPTY_PLZ_CHECK=URL format of the connection is invalid.
214+
INVALID_MONGODB_URL_PLZ_CHECK=URL format of the MongoDB connection is invalid.
215215
HOST_EMPTY_PLZ_CHECK=Host for the connection is empty.
216216
DATABASE_EMPTY=Database cannot be empty.
217-
REDIS_URI_EMPTY=Redis connection URI is empty.
217+
REDIS_URL_EMPTY=Redis connection URL is empty.
218218
PORT_EMPTY=Connection Port is empty.
219219
INVALID_PORT=Port number cannot be negative.
220220
AUTH_ERROR=Authentication error, please contact system administrator.

server/api-service/lowcoder-server/src/main/resources/application-lowcoder.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ springdoc:
5454
path: /api/docs/api-docs
5555
swagger-ui:
5656
path: /api/docs/swagger-ui
57-
paths-to-exclude: /api/v1/**
57+
paths-to-exclude: /api/v1/**

server/api-service/lowcoder-server/src/main/resources/selfhost/ce/application-selfhost.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ auth:
1515
spring:
1616
data:
1717
mongodb:
18-
uri: ${MONGODB_URI:mongodb://localhost:27017/lowcoder?socketTimeoutMS=5000}
18+
uri: ${MONGODB_URL:mongodb://localhost:27017/lowcoder?socketTimeoutMS=5000}
1919
redis:
2020
url: ${REDIS_URL:redis://localhost:6379}

server/api-service/lowcoder-server/src/main/resources/selfhost/ce/application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ common:
3939
version: 1.1.8
4040
block-hound-enable: false
4141
js-executor:
42-
host: ${JS_EXECUTOR_URI:http://127.0.0.1:6060}
42+
host: ${LOWCODER_NODE_SERVICE_URL:http://127.0.0.1:6060}
4343
max-query-request-size-in-mb: 20
4444
max-query-response-size-in-mb: 20
4545

0 commit comments

Comments
 (0)