From dae3ee17050d0717156513c72172d365373351c5 Mon Sep 17 00:00:00 2001 From: Ludo Mikula Date: Thu, 15 Jun 2023 17:08:36 +0200 Subject: [PATCH 1/4] feat: make biz thresholds configurable --- deploy/docker/README.md | 63 +++++++++++-------- deploy/docker/docker-compose-multi.yaml | 5 ++ deploy/docker/docker-compose.yaml | 5 ++ .../api/bizthreshold/BizThresholdChecker.java | 26 ++++++-- .../main/resources/application-lowcoder.yml | 7 +++ .../resources/selfhost/ce/application.yml | 7 +++ 6 files changed, 82 insertions(+), 31 deletions(-) diff --git a/deploy/docker/README.md b/deploy/docker/README.md index 6e29eb483..338149f3b 100644 --- a/deploy/docker/README.md +++ b/deploy/docker/README.md @@ -21,24 +21,29 @@ DOCKER_BUILDKIT=1 docker build -f deploy/docker/Dockerfile -t lowcoderorg/lowcod Image can be configured by setting environment variables. -| Environment variable | Description | Value | -| --------------------------------| --------------------------------------------------------------------| ------------------------------------------------------- | -| `REDIS_ENABLED` | If **true** redis server is started in the container | `true` | -| `MONGODB_ENABLED` | If **true** mongo database is started in the container | `true` | -| `API_SERVICE_ENABLED` | If **true** lowcoder api-service is started in the container | `true` | -| `NODE_SERVICE_ENABLED` | If **true** lowcoder node-service is started in the container | `true` | -| `FRONTEND_ENABLED` | If **true** lowcoder web frontend is started in the container | `true` | -| `PUID` | ID of user running services. It will own all created logs and data. | `9001` | -| `PGID` | ID of group of the user running services. | `9001` | +| Environment variable | Description | Value | +| --------------------------------| --------------------------------------------------------------------| ----------------------------------------------------- | +| `REDIS_ENABLED` | If **true** redis server is started in the container | `true` | +| `MONGODB_ENABLED` | If **true** mongo database is started in the container | `true` | +| `API_SERVICE_ENABLED` | If **true** lowcoder api-service is started in the container | `true` | +| `NODE_SERVICE_ENABLED` | If **true** lowcoder node-service is started in the container | `true` | +| `FRONTEND_ENABLED` | If **true** lowcoder web frontend is started in the container | `true` | +| `PUID` | ID of user running services. It will own all created logs and data. | `9001` | +| `PGID` | ID of group of the user running services. | `9001` | | `MONGODB_URI` | Mongo database connection string | `mongodb://localhost:27017/lowcoder?authSource=admin` | -| `REDIS_URL` | Redis server URL | `redis://localhost:6379` | -| `JS_EXECUTOR_URI` | Node service URL | `http://localhost:6060` | -| `ENABLE_USER_SIGN_UP` | Enable registration of new users | `true` | +| `REDIS_URL` | Redis server URL | `redis://localhost:6379` | +| `JS_EXECUTOR_URI` | Node service URL | `http://localhost:6060` | +| `ENABLE_USER_SIGN_UP` | Enable registration of new users | `true` | | `ENCRYPTION_PASSWORD` | Encryption password | `lowcoder.org` | | `ENCRYPTION_SALT` | Salt used for encrypting password | `lowcoder.org` | -| `CORS_ALLOWED_DOMAINS` | CORS allowed domains | `*` | -| `LOWCODER_API_SERVICE_URL` | Lowcoder API service URL | `http://localhost:8080` | -| `LOWCODER_NODE_SERVICE_URL` | Lowcoder Node service (js executor) URL | `http://localhost:6060` | +| `CORS_ALLOWED_DOMAINS` | CORS allowed domains | `*` | +| `LOWCODER_API_SERVICE_URL` | Lowcoder API service URL | `http://localhost:8080` | +| `LOWCODER_NODE_SERVICE_URL` | Lowcoder Node service (js executor) URL | `http://localhost:6060` | +| `DEFAULT_ORGS_PER_USER` | Default maximum organizations per user | `100` | +| `DEFAULT_ORG_MEMBER_COUNT` | Default maximum members per organization | `1000` | +| `DEFAULT_ORG_GROUP_COUNT` | Default maximum groups per organization | `100` | +| `DEFAULT_ORG_APP_COUNT` | Default maximum applications per organization | `1000` | +| `DEFAULT_DEVELOPER_COUNT` | Default maximum developers | `100` | ## Building api-service image @@ -57,17 +62,23 @@ DOCKER_BUILDKIT=1 docker build -f deploy/docker/Dockerfile -t lowcoderorg/lowcod Image can be configured by setting environment variables. -| Environment variable | Description | Value | -| --------------------------------| --------------------------------------------------------------------| ------------------------------------------------------- | -| `PUID` | ID of user running services. It will own all created logs and data. | `9001` | -| `PGID` | ID of group of the user running services. | `9001` | +| Environment variable | Description | Value | +| --------------------------------| --------------------------------------------------------------------| ------------------------------------------------------| +| `PUID` | ID of user running services. It will own all created logs and data. | `9001` | +| `PGID` | ID of group of the user running services. | `9001` | | `MONGODB_URI` | Mongo database connection string | `mongodb://localhost:27017/lowcoder?authSource=admin` | -| `REDIS_URL` | Redis server URL | `redis://localhost:6379` | -| `JS_EXECUTOR_URI` | Node service URL | `http://localhost:6060` | -| `ENABLE_USER_SIGN_UP` | Enable registration of new users | `true` | +| `REDIS_URL` | Redis server URL | `redis://localhost:6379` | +| `JS_EXECUTOR_URI` | Node service URL | `http://localhost:6060` | +| `ENABLE_USER_SIGN_UP` | Enable registration of new users | `true` | | `ENCRYPTION_PASSWORD` | Encryption password | `lowcoder.org` | | `ENCRYPTION_SALT` | Salt used for encrypting password | `lowcoder.org` | -| `CORS_ALLOWED_DOMAINS` | CORS allowed domains | `*` | +| `CORS_ALLOWED_DOMAINS` | CORS allowed domains | `*` | +| `DEFAULT_ORGS_PER_USER` | Default maximum organizations per user | `100` | +| `DEFAULT_ORG_MEMBER_COUNT` | Default maximum members per organization | `1000` | +| `DEFAULT_ORG_GROUP_COUNT` | Default maximum groups per organization | `100` | +| `DEFAULT_ORG_APP_COUNT` | Default maximum applications per organization | `1000` | +| `DEFAULT_DEVELOPER_COUNT` | Default maximum developers | `100` | + ## Building node-service image @@ -90,7 +101,7 @@ Image can be configured by setting environment variables. | --------------------------------| --------------------------------------------------------------------| ------------------------------------------------------- | | `PUID` | ID of user running services. It will own all created logs and data. | `9001` | | `PGID` | ID of group of the user running services. | `9001` | -| `LOWCODER_API_SERVICE_URL` | Lowcoder API service URL | `http://localhost:8080` | +| `LOWCODER_API_SERVICE_URL` | Lowcoder API service URL | `http://localhost:8080` | ## Building web frontend image @@ -112,7 +123,7 @@ Image can be configured by setting environment variables. | --------------------------------| --------------------------------------------------------------------| ------------------------------------------------------- | | `PUID` | ID of user running services. It will own all created logs and data. | `9001` | | `PGID` | ID of group of the user running services. | `9001` | -| `LOWCODER_API_SERVICE_URL` | Lowcoder API service URL | `http://localhost:8080` | -| `LOWCODER_NODE_SERVICE_URL` | Lowcoder Node service (js executor) URL | `http://localhost:6060` | +| `LOWCODER_API_SERVICE_URL` | Lowcoder API service URL | `http://localhost:8080` | +| `LOWCODER_NODE_SERVICE_URL` | Lowcoder Node service (js executor) URL | `http://localhost:6060` | diff --git a/deploy/docker/docker-compose-multi.yaml b/deploy/docker/docker-compose-multi.yaml index 702063065..15fb22ca3 100644 --- a/deploy/docker/docker-compose-multi.yaml +++ b/deploy/docker/docker-compose-multi.yaml @@ -40,6 +40,11 @@ services: ENCRYPTION_PASSWORD: "lowcoder.org" ENCRYPTION_SALT: "lowcoder.org" CORS_ALLOWED_DOMAINS: "*" + DEFAULT_ORGS_PER_USER: 100 + DEFAULT_ORG_MEMBER_COUNT: 1000 + DEFAULT_ORG_GROUP_COUNT: 100 + DEFAULT_ORG_APP_COUNT: 1000 + DEFAULT_DEVELOPER_COUNT: 50 restart: unless-stopped depends_on: - mongodb diff --git a/deploy/docker/docker-compose.yaml b/deploy/docker/docker-compose.yaml index 6b3e7ef0a..4c5625991 100644 --- a/deploy/docker/docker-compose.yaml +++ b/deploy/docker/docker-compose.yaml @@ -20,6 +20,11 @@ services: PUID: "1000" PGID: "1000" # api-service parameters + DEFAULT_ORGS_PER_USER: 100 + DEFAULT_ORG_MEMBER_COUNT: 1000 + DEFAULT_ORG_GROUP_COUNT: 100 + DEFAULT_ORG_APP_COUNT: 1000 + DEFAULT_DEVELOPER_COUNT: 50 #MONGODB_URI: "mongodb://lowcoder:secret123@mongodb/lowcoder?authSource=admin" MONGODB_URI: "mongodb://localhost:27017/lowcoder?authSource=admin" REDIS_URL: "redis://localhost:6379" diff --git a/server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/bizthreshold/BizThresholdChecker.java b/server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/bizthreshold/BizThresholdChecker.java index 65d5d7be6..3cba6c33d 100644 --- a/server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/bizthreshold/BizThresholdChecker.java +++ b/server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/bizthreshold/BizThresholdChecker.java @@ -9,6 +9,7 @@ import org.lowcoder.sdk.config.dynamic.ConfigCenter; import org.lowcoder.sdk.config.dynamic.ConfigInstance; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import reactor.core.publisher.Mono; @@ -16,6 +17,21 @@ @Service public class BizThresholdChecker extends AbstractBizThresholdChecker { + @Value("${default.orgsPerUser:100}") + private int defaultMaxOrgPerUser; + + @Value("${default.maxOrgMemberCount:1000}") + private int defaultMaxOrgMemberCount; + + @Value("${default.maxOrgGroupCount:100}") + private int defaultMaxOrgGroupCount; + + @Value("${default.maxOrgAppCount:1000}") + private int defaultMaxOrgAppCount; + + @Value("${default.maxDeveloperCount:100}") + private int defaultMaxDeveloperCount; + @Autowired private ConfigCenter configCenter; @@ -31,14 +47,14 @@ public class BizThresholdChecker extends AbstractBizThresholdChecker { @PostConstruct private void init() { ConfigInstance threshold = configCenter.threshold(); - maxOrgPerUser = threshold.ofInteger("maxOrgPerUser", 5); + maxOrgPerUser = threshold.ofInteger("maxOrgPerUser", defaultMaxOrgPerUser); userOrgCountWhiteList = threshold.ofMap("userOrgCountWhiteList", String.class, Integer.class, Collections.emptyMap()); - maxOrgMemberCount = threshold.ofInteger("maxOrgMemberCount", 50); + maxOrgMemberCount = threshold.ofInteger("maxOrgMemberCount", defaultMaxOrgMemberCount); orgMemberCountWhiteList = threshold.ofMap("orgMemberCountWhiteList", String.class, Integer.class, Collections.emptyMap()); - maxOrgGroupCount = threshold.ofInteger("maxOrgGroupCount", 10); - maxOrgAppCount = threshold.ofInteger("maxOrgAppCount", 50); + maxOrgGroupCount = threshold.ofInteger("maxOrgGroupCount", defaultMaxOrgGroupCount); + maxOrgAppCount = threshold.ofInteger("maxOrgAppCount", defaultMaxOrgAppCount); orgAppCountWhiteList = threshold.ofMap("orgAppCountWhiteList", String.class, Integer.class, Collections.emptyMap()); - maxDeveloperCount = threshold.ofInteger("maxDeveloperCount", 50); + maxDeveloperCount = threshold.ofInteger("maxDeveloperCount", defaultMaxDeveloperCount); } @Override diff --git a/server/api-service/lowcoder-server/src/main/resources/application-lowcoder.yml b/server/api-service/lowcoder-server/src/main/resources/application-lowcoder.yml index 3ba6e2c56..cb1005217 100644 --- a/server/api-service/lowcoder-server/src/main/resources/application-lowcoder.yml +++ b/server/api-service/lowcoder-server/src/main/resources/application-lowcoder.yml @@ -23,6 +23,13 @@ server: port: 8080 shutdown: graceful +default: + orgs-per-user: 100 + org-member-count: 1000 + org-group-count: 100 + org-app-count: 1000 + developer-count: 50 + common: cookie-name: LOCAL_LOWCODER_TOKEN product: lowcoder diff --git a/server/api-service/lowcoder-server/src/main/resources/selfhost/ce/application.yml b/server/api-service/lowcoder-server/src/main/resources/selfhost/ce/application.yml index c234e8cc3..5599df379 100644 --- a/server/api-service/lowcoder-server/src/main/resources/selfhost/ce/application.yml +++ b/server/api-service/lowcoder-server/src/main/resources/selfhost/ce/application.yml @@ -23,6 +23,13 @@ server: port: 8080 shutdown: graceful +default: + orgs-per-user: 100 + org-member-count: 1000 + org-group-count: 100 + org-app-count: 1000 + developer-count: 50 + common: cookie-name: LOWCODER_CE_SELFHOST_TOKEN product: lowcoder From 4768b4bd16adbbe38f9712c4c2fc45a6dc821197 Mon Sep 17 00:00:00 2001 From: Ludo Mikula Date: Sat, 17 Jun 2023 07:54:17 +0200 Subject: [PATCH 2/4] feat: add possibility to disable specific endpoints --- .../org/lowcoder/sdk/config/CommonConfig.java | 15 +++++++++++++++ .../api/framework/security/SecurityConfig.java | 15 +++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/server/api-service/lowcoder-sdk/src/main/java/org/lowcoder/sdk/config/CommonConfig.java b/server/api-service/lowcoder-sdk/src/main/java/org/lowcoder/sdk/config/CommonConfig.java index 778c24450..fc5e6882c 100644 --- a/server/api-service/lowcoder-sdk/src/main/java/org/lowcoder/sdk/config/CommonConfig.java +++ b/server/api-service/lowcoder-sdk/src/main/java/org/lowcoder/sdk/config/CommonConfig.java @@ -8,9 +8,11 @@ import java.util.Set; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.StringUtils; import org.lowcoder.sdk.constants.WorkspaceMode; import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.http.HttpMethod; import org.springframework.stereotype.Component; import lombok.Data; @@ -63,6 +65,8 @@ public static class Security { // support of docker env file. private String corsAllowedDomainString; + private List forbiddenEndpoints; + public List getAllCorsAllowedDomains() { List all = new ArrayList<>(); if (CollectionUtils.isNotEmpty(corsAllowedDomains)) { @@ -74,8 +78,19 @@ public List getAllCorsAllowedDomains() { } return all; } + + public List getForbiddenEndpoints() + { + return ListUtils.emptyIfNull(forbiddenEndpoints); + } } + @Data + public static class ApiEndpoint { + private HttpMethod method; + private String uri; + } + @Data public static class Workspace { diff --git a/server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/framework/security/SecurityConfig.java b/server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/framework/security/SecurityConfig.java index 591ced581..1b3b82884 100644 --- a/server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/framework/security/SecurityConfig.java +++ b/server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/framework/security/SecurityConfig.java @@ -34,6 +34,7 @@ import org.springframework.security.config.web.server.ServerHttpSecurity; import org.springframework.security.web.server.SecurityWebFilterChain; import org.springframework.security.web.server.ServerAuthenticationEntryPoint; +import org.springframework.security.web.server.util.matcher.ServerWebExchangeMatcher; import org.springframework.security.web.server.util.matcher.ServerWebExchangeMatchers; import org.springframework.web.cors.CorsConfiguration; import org.springframework.web.cors.reactive.CorsConfigurationSource; @@ -62,8 +63,17 @@ public class SecurityConfig { @Bean public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) { - - http.cors() + if (!commonConfig.getSecurity().getForbiddenEndpoints().isEmpty()) + { + http.authorizeExchange() + .matchers( + commonConfig.getSecurity().getForbiddenEndpoints().stream() + .map(apiEndpoint -> ServerWebExchangeMatchers.pathMatchers(apiEndpoint.getMethod(), apiEndpoint.getUri())) + .toArray(size -> new ServerWebExchangeMatcher[size]) + ).denyAll(); + } + + http.cors() .configurationSource(buildCorsConfigurationSource()) .and() .csrf().disable() @@ -137,6 +147,7 @@ public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) { return http.build(); } + /** * enable CORS */ From 96995c33b1e55980f83f37f6379ba18b577e49a3 Mon Sep 17 00:00:00 2001 From: Ludo Mikula Date: Sat, 17 Jun 2023 08:58:57 +0200 Subject: [PATCH 3/4] feat: add OpenAPI UI (based on @mingfang fork) --- .../query/service/QueryExecutionService.java | 12 +++++- server/api-service/lowcoder-server/pom.xml | 5 +++ .../api/OpenAPIDocsConfiguration.java | 38 +++++++++++++++++++ .../org/lowcoder/api/ServerApplication.java | 2 + .../framework/security/SecurityConfig.java | 3 +- .../main/resources/application-lowcoder.yml | 7 ++++ .../resources/selfhost/ce/application.yml | 7 ++++ .../node-service/src/plugins/openApi/index.ts | 17 +++------ server/node-service/src/services/plugin.ts | 8 ++++ 9 files changed, 84 insertions(+), 15 deletions(-) create mode 100644 server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/OpenAPIDocsConfiguration.java diff --git a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/query/service/QueryExecutionService.java b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/query/service/QueryExecutionService.java index 78a464fcb..86f981af7 100644 --- a/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/query/service/QueryExecutionService.java +++ b/server/api-service/lowcoder-domain/src/main/java/org/lowcoder/domain/query/service/QueryExecutionService.java @@ -47,7 +47,7 @@ public Mono executeQuery(Datasource datasource, Map { if (datasourceMetaInfoService.isJsDatasourcePlugin(datasource.getType())) { - return executeByNodeJs(datasource, queryConfig, requestParams); + return executeByNodeJs(datasource, queryConfig, requestParams, queryVisitorContext); } return executeLocally(datasource, queryConfig, requestParams, queryVisitorContext); }) @@ -77,11 +77,19 @@ private Mono executeLocally(Datasource datasource, Map executeByNodeJs(Datasource datasource, Map queryConfig, Map requestParams) { + private Mono executeByNodeJs(Datasource datasource, Map queryConfig, Map requestParams, QueryVisitorContext queryVisitorContext) { List> context = requestParams.entrySet() .stream() .map(entry -> Map.of("key", entry.getKey(), "value", entry.getValue())) .collect(Collectors.toList()); + + //forward cookies to js datasource + List> cookies = queryVisitorContext.getCookies().entrySet() + .stream() + .map(entry -> Map.of("key", entry.getKey(), "value", entry.getValue())) + .collect(Collectors.toList()); + context.addAll(cookies); + return datasourcePluginClient.executeQuery(datasource.getType(), queryConfig, context, datasource.getDetailConfig()); } } diff --git a/server/api-service/lowcoder-server/pom.xml b/server/api-service/lowcoder-server/pom.xml index 4780c490c..b71677bf7 100644 --- a/server/api-service/lowcoder-server/pom.xml +++ b/server/api-service/lowcoder-server/pom.xml @@ -54,6 +54,11 @@ org.springframework.boot spring-boot-starter-webflux + + org.springdoc + springdoc-openapi-webflux-ui + 1.7.0 + io.projectreactor.tools blockhound diff --git a/server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/OpenAPIDocsConfiguration.java b/server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/OpenAPIDocsConfiguration.java new file mode 100644 index 000000000..f450492d5 --- /dev/null +++ b/server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/OpenAPIDocsConfiguration.java @@ -0,0 +1,38 @@ +package org.lowcoder.api; + +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.security.SecurityRequirement; +import io.swagger.v3.oas.models.security.SecurityScheme; +import io.swagger.v3.oas.models.servers.Server; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.lowcoder.sdk.config.CommonConfig; +import org.springframework.beans.factory.annotation.Autowired; + +@Configuration +public class OpenAPIDocsConfiguration { + @Autowired + private CommonConfig commonConfig; + + @Bean + public OpenAPI customizeOpenAPI() { + final String securitySchemeName = commonConfig.getCookieName(); + return new OpenAPI() + .info(new Info() + .title("Lowcoder API") + .version("1.0")) + .addServersItem(new Server() + .url("/")) + .addSecurityItem(new SecurityRequirement() + .addList(securitySchemeName)).components(new Components() + .addSecuritySchemes( + securitySchemeName, + new SecurityScheme() + .name(securitySchemeName) + .type(SecurityScheme.Type.APIKEY) + .in(SecurityScheme.In.COOKIE) + )); + } +} \ No newline at end of file diff --git a/server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/ServerApplication.java b/server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/ServerApplication.java index 775c1f04f..7da9a57e6 100644 --- a/server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/ServerApplication.java +++ b/server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/ServerApplication.java @@ -11,6 +11,7 @@ import org.springframework.context.annotation.ComponentScan; import org.springframework.scheduling.annotation.EnableScheduling; +import io.swagger.v3.oas.annotations.OpenAPIDefinition; import lombok.extern.slf4j.Slf4j; import reactor.blockhound.BlockHound; import reactor.core.publisher.Hooks; @@ -22,6 +23,7 @@ @ComponentScan(basePackages = "org.lowcoder.api.framework.configuration") @EnableScheduling @EnableConfigurationProperties +@OpenAPIDefinition public class ServerApplication { @Autowired diff --git a/server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/framework/security/SecurityConfig.java b/server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/framework/security/SecurityConfig.java index 1b3b82884..aeef1e321 100644 --- a/server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/framework/security/SecurityConfig.java +++ b/server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/framework/security/SecurityConfig.java @@ -126,7 +126,8 @@ public SecurityWebFilterChain securityWebFilterChain(ServerHttpSecurity http) { ServerWebExchangeMatchers.pathMatchers(HttpMethod.POST, NewUrl.QUERY_URL + "/execute"), ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET, NewUrl.MATERIAL_URL + "/**"), ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET, NewUrl.ORGANIZATION_URL + "/*/datasourceTypes"), // datasource types - ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET, NewUrl.DATASOURCE_URL + "/jsDatasourcePlugins") + ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET, NewUrl.DATASOURCE_URL + "/jsDatasourcePlugins"), + ServerWebExchangeMatchers.pathMatchers(HttpMethod.GET, "/api/docs/**") ) .permitAll() .pathMatchers("/api/**") diff --git a/server/api-service/lowcoder-server/src/main/resources/application-lowcoder.yml b/server/api-service/lowcoder-server/src/main/resources/application-lowcoder.yml index cb1005217..52ce3e063 100644 --- a/server/api-service/lowcoder-server/src/main/resources/application-lowcoder.yml +++ b/server/api-service/lowcoder-server/src/main/resources/application-lowcoder.yml @@ -48,3 +48,10 @@ common: material: mongodb-grid-fs: bucket-name: material + +springdoc: + api-docs: + path: /api/docs/api-docs + swagger-ui: + path: /api/docs/swagger-ui + paths-to-exclude: /api/v1/** \ No newline at end of file diff --git a/server/api-service/lowcoder-server/src/main/resources/selfhost/ce/application.yml b/server/api-service/lowcoder-server/src/main/resources/selfhost/ce/application.yml index 5599df379..89f86f4cd 100644 --- a/server/api-service/lowcoder-server/src/main/resources/selfhost/ce/application.yml +++ b/server/api-service/lowcoder-server/src/main/resources/selfhost/ce/application.yml @@ -46,3 +46,10 @@ common: material: mongodb-grid-fs: bucket-name: material + +springdoc: + api-docs: + path: /api/docs/api-docs + swagger-ui: + path: /api/docs/swagger-ui + paths-to-exclude: /api/v1/** diff --git a/server/node-service/src/plugins/openApi/index.ts b/server/node-service/src/plugins/openApi/index.ts index e807f4292..32e555ca4 100644 --- a/server/node-service/src/plugins/openApi/index.ts +++ b/server/node-service/src/plugins/openApi/index.ts @@ -25,7 +25,7 @@ const dataSourceConfig = { label: "Spec URL", key: "url", type: "textInput", - updatable: false, + updatable: true, rules: [ { required: true, @@ -146,18 +146,11 @@ const openApiPlugin: DataSourcePlugin = { dataSourceConfig: { ...dataSourceConfig, extra: async (dataSourceConfig) => { - const { url, extra } = dataSourceConfig; - let spec: string = extra?.spec; - let specObj: OpenAPI.Document; - if (!spec) { - // retrieve spec from remote only once - const { spec: remoteSpec } = await retrieveSpec(url); - specObj = remoteSpec; - spec = JSON.stringify(remoteSpec); - } else { - specObj = safeJsonParse(spec); - } + // called whenever datasource config opens or changes + const { url} = dataSourceConfig; + const { spec: specObj} = await retrieveSpec(url); const extraParams = await authParamsConfig(specObj); + const spec = JSON.stringify(specObj); return { data: { spec, diff --git a/server/node-service/src/services/plugin.ts b/server/node-service/src/services/plugin.ts index 79d5657f4..e25505ddb 100644 --- a/server/node-service/src/services/plugin.ts +++ b/server/node-service/src/services/plugin.ts @@ -211,6 +211,14 @@ export async function runPluginQuery( const plugin = getPlugin(pluginName, pluginContext); const queryConfig = await getQueryConfig(plugin, dataSourceConfig); const action = await evalToValue(queryConfig, dsl, context, dataSourceConfig); + + //forward cookies + context.forEach(({ key, value }) => { + if (key in dataSourceConfig.dynamicParamsConfig) { + const valueKey = `${key}.value`; + dataSourceConfig.dynamicParamsConfig[valueKey] = value[0].value + } + }) const result = await plugin.run(action, dataSourceConfig, pluginContext); return { From c640eb64995f40a1a723cb709b6bc44b772e63ec Mon Sep 17 00:00:00 2001 From: Ludo Mikula Date: Sun, 18 Jun 2023 12:59:49 +0200 Subject: [PATCH 4/4] chore: unify naming of environment variables --- app.json | 4 ++-- deploy/docker/README.md | 6 ++---- deploy/docker/docker-compose-multi.yaml | 4 ++-- deploy/docker/docker-compose.yaml | 5 ++--- deploy/helm/templates/api-service/configMap.yaml | 4 ++-- deploy/helm/templates/api-service/secrets.yaml | 4 ++-- docs/self-hosting/README.md | 10 +++++----- .../org/lowcoder/plugin/mongo/MongoPlugin.java | 10 +++++----- .../mongo/model/MongoConnectionUriParser.java | 8 ++++---- .../java/org/lowcoder/plugin/redis/RedisError.java | 2 +- .../org/lowcoder/plugin/redis/RedisPlugin.java | 6 +++--- .../src/main/resources/locale_en.properties | 14 +++++++------- .../src/main/resources/application-lowcoder.yml | 2 +- .../resources/selfhost/ce/application-selfhost.yml | 2 +- .../src/main/resources/selfhost/ce/application.yml | 2 +- 15 files changed, 40 insertions(+), 43 deletions(-) diff --git a/app.json b/app.json index c5508ec4e..0889503a9 100644 --- a/app.json +++ b/app.json @@ -27,8 +27,8 @@ "description": "The domains supported for CORS requests. All domains are allowed by default. If there are multiple domains, please separate them with commas.", "required": false }, - "MONGODB_URI": { - "description": "Your Mongo Database URI.", + "MONGODB_URL": { + "description": "Your Mongo Database URL.", "required": false }, "REDIS_URL": { diff --git a/deploy/docker/README.md b/deploy/docker/README.md index 338149f3b..24252ee9e 100644 --- a/deploy/docker/README.md +++ b/deploy/docker/README.md @@ -30,9 +30,8 @@ Image can be configured by setting environment variables. | `FRONTEND_ENABLED` | If **true** lowcoder web frontend is started in the container | `true` | | `PUID` | ID of user running services. It will own all created logs and data. | `9001` | | `PGID` | ID of group of the user running services. | `9001` | -| `MONGODB_URI` | Mongo database connection string | `mongodb://localhost:27017/lowcoder?authSource=admin` | +| `MONGODB_URL` | Mongo database connection string | `mongodb://localhost:27017/lowcoder?authSource=admin` | | `REDIS_URL` | Redis server URL | `redis://localhost:6379` | -| `JS_EXECUTOR_URI` | Node service URL | `http://localhost:6060` | | `ENABLE_USER_SIGN_UP` | Enable registration of new users | `true` | | `ENCRYPTION_PASSWORD` | Encryption password | `lowcoder.org` | | `ENCRYPTION_SALT` | Salt used for encrypting password | `lowcoder.org` | @@ -66,9 +65,8 @@ Image can be configured by setting environment variables. | --------------------------------| --------------------------------------------------------------------| ------------------------------------------------------| | `PUID` | ID of user running services. It will own all created logs and data. | `9001` | | `PGID` | ID of group of the user running services. | `9001` | -| `MONGODB_URI` | Mongo database connection string | `mongodb://localhost:27017/lowcoder?authSource=admin` | +| `MONGODB_URL` | Mongo database connection string | `mongodb://localhost:27017/lowcoder?authSource=admin` | | `REDIS_URL` | Redis server URL | `redis://localhost:6379` | -| `JS_EXECUTOR_URI` | Node service URL | `http://localhost:6060` | | `ENABLE_USER_SIGN_UP` | Enable registration of new users | `true` | | `ENCRYPTION_PASSWORD` | Encryption password | `lowcoder.org` | | `ENCRYPTION_SALT` | Salt used for encrypting password | `lowcoder.org` | diff --git a/deploy/docker/docker-compose-multi.yaml b/deploy/docker/docker-compose-multi.yaml index 15fb22ca3..5bfd50d0f 100644 --- a/deploy/docker/docker-compose-multi.yaml +++ b/deploy/docker/docker-compose-multi.yaml @@ -33,9 +33,9 @@ services: environment: PUID: "9001" PGID: "9001" - MONGODB_URI: "mongodb://lowcoder:secret123@mongodb/lowcoder?authSource=admin" + MONGODB_URL: "mongodb://lowcoder:secret123@mongodb/lowcoder?authSource=admin" REDIS_URL: "redis://redis:6379" - JS_EXECUTOR_URI: "http://lowcoder-node-service:6060" + LOWCODER_NODE_SERVICE_URL: "http://lowcoder-node-service:6060" ENABLE_USER_SIGN_UP: "true" ENCRYPTION_PASSWORD: "lowcoder.org" ENCRYPTION_SALT: "lowcoder.org" diff --git a/deploy/docker/docker-compose.yaml b/deploy/docker/docker-compose.yaml index 4c5625991..3ed3639ee 100644 --- a/deploy/docker/docker-compose.yaml +++ b/deploy/docker/docker-compose.yaml @@ -25,10 +25,9 @@ services: DEFAULT_ORG_GROUP_COUNT: 100 DEFAULT_ORG_APP_COUNT: 1000 DEFAULT_DEVELOPER_COUNT: 50 - #MONGODB_URI: "mongodb://lowcoder:secret123@mongodb/lowcoder?authSource=admin" - MONGODB_URI: "mongodb://localhost:27017/lowcoder?authSource=admin" + #MONGODB_URL: "mongodb://lowcoder:secret123@mongodb/lowcoder?authSource=admin" + MONGODB_URL: "mongodb://localhost:27017/lowcoder?authSource=admin" REDIS_URL: "redis://localhost:6379" - JS_EXECUTOR_URI: "http://localhost:6060" ENABLE_USER_SIGN_UP: "true" ENCRYPTION_PASSWORD: "lowcoder.org" ENCRYPTION_SALT: "lowcoder.org" diff --git a/deploy/helm/templates/api-service/configMap.yaml b/deploy/helm/templates/api-service/configMap.yaml index 2d9abad8a..ae09a821a 100644 --- a/deploy/helm/templates/api-service/configMap.yaml +++ b/deploy/helm/templates/api-service/configMap.yaml @@ -18,9 +18,9 @@ data: REDIS_URL: {{- .Values.redis.externalUrl | quote }} {{- end }} {{- if .Values.apiService.nodeServiceUrl }} - JS_EXECUTOR_URI: {{ .Values.apiService.nodeServiceUrl | quote }} + LOWCODER_NODE_SERVICE_URL: {{ .Values.apiService.nodeServiceUrl | quote }} {{- else }} - JS_EXECUTOR_URI: "http://{{ $name }}-node-service:{{ .Values.nodeService.service.port }}" + LOWCODER_NODE_SERVICE_URL: "http://{{ $name }}-node-service:{{ .Values.nodeService.service.port }}" {{- end }} PUID: {{ .Values.apiService.config.userId | default "9001" | quote }} PGID: {{ .Values.apiService.config.groupId | default "9001" | quote }} diff --git a/deploy/helm/templates/api-service/secrets.yaml b/deploy/helm/templates/api-service/secrets.yaml index 64aa009e9..7f6752f66 100644 --- a/deploy/helm/templates/api-service/secrets.yaml +++ b/deploy/helm/templates/api-service/secrets.yaml @@ -16,9 +16,9 @@ metadata: {{- end }} stringData: {{- if .Values.mongodb.enabled }} - MONGODB_URI: "mongodb://{{ $mongoUser }}:{{ $mongoPassword }}@{{ $mongoServicename }}.{{ $nameSpace }}.svc.cluster.local/{{ $lowcoderDatabase }}?retryWrites=true&ssl=false" + MONGODB_URL: "mongodb://{{ $mongoUser }}:{{ $mongoPassword }}@{{ $mongoServicename }}.{{ $nameSpace }}.svc.cluster.local/{{ $lowcoderDatabase }}?retryWrites=true&ssl=false" {{- else }} - MONGODB_URI: {{- .Values.mongodb.externalUrl | quote }} + MONGODB_URL: {{- .Values.mongodb.externalUrl | quote }} {{- end }} ENCRYPTION_PASSWORD: {{ .Values.apiService.config.encryption.password | default "lowcoder.org" | quote }} ENCRYPTION_SALT: {{ .Values.apiService.config.encryption.salt | default "lowcoder.org" | quote }} diff --git a/docs/self-hosting/README.md b/docs/self-hosting/README.md index 3c1676290..8f76e22f5 100644 --- a/docs/self-hosting/README.md +++ b/docs/self-hosting/README.md @@ -136,8 +136,8 @@ For developers who require stateless containers in a cluster environment, we off
- * **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. - * **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. + * **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. + * **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. * **openblocks-api-service**: Required. * **openblocks-node-service**: Required. * **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 {% tabs %} {% tab title="Docker-Compose" %} -Add environment variables `MONGODB_URI` and `REDIS_URI` in `docker-compose.yml` downloaded in your working directory.\ +Add environment variables `MONGODB_URL` and `REDIS_URL` in `docker-compose.yml` downloaded in your working directory.\ {% endtab %} {% tab title="Docker" %} -Add environment variables `MONGODB_URI` and `REDIS_URI` to the deployment command, as shown below: +Add environment variables `MONGODB_URL` and `REDIS_URL` to the deployment command, as shown below: {% code overflow="wrap" %} ```bash -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 +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 ``` {% endcode %} {% endtab %} diff --git a/server/api-service/lowcoder-plugins/mongoPlugin/src/main/java/org/lowcoder/plugin/mongo/MongoPlugin.java b/server/api-service/lowcoder-plugins/mongoPlugin/src/main/java/org/lowcoder/plugin/mongo/MongoPlugin.java index 9526b9123..56457c05b 100644 --- a/server/api-service/lowcoder-plugins/mongoPlugin/src/main/java/org/lowcoder/plugin/mongo/MongoPlugin.java +++ b/server/api-service/lowcoder-plugins/mongoPlugin/src/main/java/org/lowcoder/plugin/mongo/MongoPlugin.java @@ -344,13 +344,13 @@ private String buildClientUri(MongoDatasourceConfig mongoDatasourceConfig) { if (mongoDatasourceConfig.isUsingUri()) { if (StringUtils.isBlank(mongoDatasourceConfig.getUri())) { - throw new PluginException(DATASOURCE_ARGUMENT_ERROR, "MONGODB_URI_EMPTY"); + throw new PluginException(DATASOURCE_ARGUMENT_ERROR, "MONGODB_URL_EMPTY"); } String uri = mongoDatasourceConfig.getUri(); Map extractedInfo = extractInfoFromConnectionStringURI(uri); if (extractedInfo == null) { - throw new PluginException(DATASOURCE_ARGUMENT_ERROR, "MONGODB_URI_EXTRACT_ERROR"); + throw new PluginException(DATASOURCE_ARGUMENT_ERROR, "MONGODB_URL_EXTRACT_ERROR"); } return uri; @@ -420,17 +420,17 @@ public Set validateConfig(MongoDatasourceConfig connectionConfig) { if (connectionConfig.isUsingUri()) { if (StringUtils.isBlank(connectionConfig.getUri())) { - return ImmutableSet.of("MONGODB_URI_EMPTY_PLZ_CHECK"); + return ImmutableSet.of("MONGODB_URL_EMPTY_PLZ_CHECK"); } String mongoUri = connectionConfig.getUri(); if (!MongoConnectionUriParser.isValid(mongoUri)) { - return ImmutableSet.of("INVALID_MONGODB_URI_PLZ_CHECK"); + return ImmutableSet.of("INVALID_MONGODB_URL_PLZ_CHECK"); } Map extractedInfo = extractInfoFromConnectionStringURI(mongoUri); if (extractedInfo == null) { - return ImmutableSet.of("INVALID_MONGODB_URI_PLZ_CHECK"); + return ImmutableSet.of("INVALID_MONGODB_URL_PLZ_CHECK"); } return invalids; diff --git a/server/api-service/lowcoder-plugins/mongoPlugin/src/main/java/org/lowcoder/plugin/mongo/model/MongoConnectionUriParser.java b/server/api-service/lowcoder-plugins/mongoPlugin/src/main/java/org/lowcoder/plugin/mongo/model/MongoConnectionUriParser.java index 424b02392..b11e01619 100644 --- a/server/api-service/lowcoder-plugins/mongoPlugin/src/main/java/org/lowcoder/plugin/mongo/model/MongoConnectionUriParser.java +++ b/server/api-service/lowcoder-plugins/mongoPlugin/src/main/java/org/lowcoder/plugin/mongo/model/MongoConnectionUriParser.java @@ -20,9 +20,9 @@ public final class MongoConnectionUriParser { * * ^(mongodb(?:\+srv)?:\/\/)(?:(.+):(.+)@)?([^\/\?]+)\/?([^\?]+)?\??(.+)?$ */ - public static final String MONGO_URI_REGEX = "^(mongodb(?:\\+srv)?://)(?:(.+):(.+)@)?([^/?]+)/?([^?]+)?\\??(.+)?$"; + public static final String MONGO_URL_REGEX = "^(mongodb(?:\\+srv)?://)(?:(.+):(.+)@)?([^/?]+)/?([^?]+)?\\??(.+)?$"; - private static final Pattern PATTERN = Pattern.compile(MONGO_URI_REGEX); + private static final Pattern PATTERN = Pattern.compile(MONGO_URL_REGEX); private static final int REGEX_GROUP_HEAD = 1; @@ -53,7 +53,7 @@ public static boolean isValid(String uri) { } public static Map extractInfoFromConnectionStringURI(String uri) { - if (!uri.matches(MONGO_URI_REGEX)) { + if (!uri.matches(MONGO_URL_REGEX)) { return null; } @@ -75,7 +75,7 @@ public static Map extractInfoFromConnectionStringURI(String uri) public static String parseDatabaseFrom(String uri) { Map extractedInfo = extractInfoFromConnectionStringURI(uri); if (extractedInfo == null) { - throw ofPluginException(DATASOURCE_ARGUMENT_ERROR, "INVALID_MONGODB_URI"); + throw ofPluginException(DATASOURCE_ARGUMENT_ERROR, "INVALID_MONGODB_URL"); } String database = extractedInfo.get(KEY_URI_DBNAME); diff --git a/server/api-service/lowcoder-plugins/redisPlugin/src/main/java/org/lowcoder/plugin/redis/RedisError.java b/server/api-service/lowcoder-plugins/redisPlugin/src/main/java/org/lowcoder/plugin/redis/RedisError.java index 05625b586..4e73f439d 100644 --- a/server/api-service/lowcoder-plugins/redisPlugin/src/main/java/org/lowcoder/plugin/redis/RedisError.java +++ b/server/api-service/lowcoder-plugins/redisPlugin/src/main/java/org/lowcoder/plugin/redis/RedisError.java @@ -7,7 +7,7 @@ public enum RedisError implements PluginError { // redis REDIS_EXECUTION_ERROR, - REDIS_URI_ERROR, + REDIS_URL_ERROR, } diff --git a/server/api-service/lowcoder-plugins/redisPlugin/src/main/java/org/lowcoder/plugin/redis/RedisPlugin.java b/server/api-service/lowcoder-plugins/redisPlugin/src/main/java/org/lowcoder/plugin/redis/RedisPlugin.java index 670ed32d3..3b0c54e91 100644 --- a/server/api-service/lowcoder-plugins/redisPlugin/src/main/java/org/lowcoder/plugin/redis/RedisPlugin.java +++ b/server/api-service/lowcoder-plugins/redisPlugin/src/main/java/org/lowcoder/plugin/redis/RedisPlugin.java @@ -19,7 +19,7 @@ import static com.google.common.collect.Maps.newHashMap; import static java.util.Objects.isNull; import static org.lowcoder.plugin.redis.RedisError.REDIS_EXECUTION_ERROR; -import static org.lowcoder.plugin.redis.RedisError.REDIS_URI_ERROR; +import static org.lowcoder.plugin.redis.RedisError.REDIS_URL_ERROR; import static org.lowcoder.plugin.redis.constants.RedisConstants.JEDIS_POOL_MAX_IDLE; import static org.lowcoder.plugin.redis.constants.RedisConstants.JEDIS_POOL_MAX_TOTAL; import static org.lowcoder.plugin.redis.constants.RedisConstants.JEDIS_POOL_MIN_EVICTABLE_IDLE_MILLIS; @@ -101,7 +101,7 @@ public Mono createConnection(RedisDatasourceConfig connectionConfig) .subscribeOn(scheduler) .onErrorMap(t -> { if (t instanceof ArrayIndexOutOfBoundsException && connectionConfig.isUsingUri()) { - return new PluginException(REDIS_URI_ERROR, "REDIS_URI_ERROR", t.getMessage()); + return new PluginException(REDIS_URL_ERROR, "REDIS_URL_ERROR", t.getMessage()); } return t; }); @@ -173,7 +173,7 @@ public Set validateConfig(RedisDatasourceConfig connectionConfig) { if (connectionConfig.isUsingUri()) { if (StringUtils.isBlank(connectionConfig.getUri())) { - invalids.add("REDIS_URI_EMPTY"); + invalids.add("REDIS_URL_EMPTY"); } } else { if (StringUtils.isBlank(host)) { diff --git a/server/api-service/lowcoder-sdk/src/main/resources/locale_en.properties b/server/api-service/lowcoder-sdk/src/main/resources/locale_en.properties index 1da28be24..2c67433fc 100644 --- a/server/api-service/lowcoder-sdk/src/main/resources/locale_en.properties +++ b/server/api-service/lowcoder-sdk/src/main/resources/locale_en.properties @@ -99,7 +99,7 @@ NO_PERMISSION_TO_VIEW=It appears you don''t have the permission to view, please INVALID_QUERY_ID=Invalid query ID. INVALID_ES_CONFIG=Illegal elasticsearch data source configuration. INVALID_CONNECTION_STRING=Fail to parse connectionString. -INVALID_MONGODB_URI=Illegal MongoDB URI format, please check again. +INVALID_MONGODB_URL=Illegal MongoDB URL format, please check again. MONGODB_DATABASE_EMPTY=MongoDB database cannot be empty. DATASOURCE_NAME_EMPTY=Illegal data source configuration: data source name is empty. INVALID_DATASOURCE_TYPE_0=Illegal data source type. @@ -129,7 +129,7 @@ CONNECTION_ERROR=Connection error: {0}. MONGODB_COMMAND_ERROR=Illegal MongoDB query: {0} REST_API_EXECUTION_ERROR=REST API execution error: {0}. REDIS_EXECUTION_ERROR=Sorry, Redis execution error: {0}. -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. +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. LOWCODER_INTERNAL_REQUEST_ERROR=Request failed: {0}. LOWCODER_INTERNAL_INVALID_REQUEST_TYPE=Invalid Lowcoder API request type, please contact the administrator. ES_EXECUTION_ERROR=Elasticsearch query execution error: {0}. @@ -174,8 +174,8 @@ INVALID_PG_QUERY_CONFIG_EMPTY=PostgreSQL query configuration is empty. INVALID_PG=Failed to parse PostgreSQL query configuration. INVALID_RESTAPI=Failed to parse REST API query configuration. GET_MONGODB_STRUCTURE_ERROR=Failed to get MongoDB structure. -MONGODB_URI_EMPTY=MongoDB''s connection URI is empty. -MONGODB_URI_EXTRACT_ERROR=Failed to resolve MongoDB connection URI. +MONGODB_URL_EMPTY=MongoDB''s connection URL is empty. +MONGODB_URL_EXTRACT_ERROR=Failed to resolve MongoDB connection URL. CONTENT_PARSE_ERROR=Resolve upload data failed, it requires format {data:base64 string, name:string} or an array of it MULTIFORM_DATA_IS_NOT_STRING=Resolve upload data failed, data field is not a valid base64 string 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. INVALID_HOST=Invalid Host. DATABASE_NAME_EMPTY=Database name cannot be empty. CONNECTION_STRING_EMPTY=The connection string cannot be empty. -MONGODB_URI_EMPTY_PLZ_CHECK=URI format of the connection is invalid. -INVALID_MONGODB_URI_PLZ_CHECK=URI format of the MongoDB connection is invalid. +MONGODB_URL_EMPTY_PLZ_CHECK=URL format of the connection is invalid. +INVALID_MONGODB_URL_PLZ_CHECK=URL format of the MongoDB connection is invalid. HOST_EMPTY_PLZ_CHECK=Host for the connection is empty. DATABASE_EMPTY=Database cannot be empty. -REDIS_URI_EMPTY=Redis connection URI is empty. +REDIS_URL_EMPTY=Redis connection URL is empty. PORT_EMPTY=Connection Port is empty. INVALID_PORT=Port number cannot be negative. AUTH_ERROR=Authentication error, please contact system administrator. diff --git a/server/api-service/lowcoder-server/src/main/resources/application-lowcoder.yml b/server/api-service/lowcoder-server/src/main/resources/application-lowcoder.yml index 52ce3e063..7994c4563 100644 --- a/server/api-service/lowcoder-server/src/main/resources/application-lowcoder.yml +++ b/server/api-service/lowcoder-server/src/main/resources/application-lowcoder.yml @@ -54,4 +54,4 @@ springdoc: path: /api/docs/api-docs swagger-ui: path: /api/docs/swagger-ui - paths-to-exclude: /api/v1/** \ No newline at end of file + paths-to-exclude: /api/v1/** diff --git a/server/api-service/lowcoder-server/src/main/resources/selfhost/ce/application-selfhost.yml b/server/api-service/lowcoder-server/src/main/resources/selfhost/ce/application-selfhost.yml index ae65dec38..6c1604d92 100644 --- a/server/api-service/lowcoder-server/src/main/resources/selfhost/ce/application-selfhost.yml +++ b/server/api-service/lowcoder-server/src/main/resources/selfhost/ce/application-selfhost.yml @@ -15,6 +15,6 @@ auth: spring: data: mongodb: - uri: ${MONGODB_URI:mongodb://localhost:27017/lowcoder?socketTimeoutMS=5000} + uri: ${MONGODB_URL:mongodb://localhost:27017/lowcoder?socketTimeoutMS=5000} redis: url: ${REDIS_URL:redis://localhost:6379} diff --git a/server/api-service/lowcoder-server/src/main/resources/selfhost/ce/application.yml b/server/api-service/lowcoder-server/src/main/resources/selfhost/ce/application.yml index 89f86f4cd..15323a7c5 100644 --- a/server/api-service/lowcoder-server/src/main/resources/selfhost/ce/application.yml +++ b/server/api-service/lowcoder-server/src/main/resources/selfhost/ce/application.yml @@ -39,7 +39,7 @@ common: version: 1.1.8 block-hound-enable: false js-executor: - host: ${JS_EXECUTOR_URI:http://127.0.0.1:6060} + host: ${LOWCODER_NODE_SERVICE_URL:http://127.0.0.1:6060} max-query-request-size-in-mb: 20 max-query-response-size-in-mb: 20