Skip to content

Commit 3856cf5

Browse files
authored
Merge branch 'main' into Fix_And_Improve_JsonLottie
2 parents c0efe11 + 494f9f1 commit 3856cf5

File tree

14 files changed

+206
-28
lines changed

14 files changed

+206
-28
lines changed

deploy/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ RUN --mount=type=cache,target=/root/.m2 mvn -f pom.xml clean package -DskipTests
2020
RUN mkdir -p /lowcoder/api-service/plugins /lowcoder/api-service/config /lowcoder/api-service/logs
2121

2222
# Define lowcoder main jar and plugin jars
23-
ARG JAR_FILE=/lowcoder-server/lowcoder-server/target/lowcoder-server-1.0-SNAPSHOT.jar
23+
ARG JAR_FILE=/lowcoder-server/lowcoder-server/target/lowcoder-server-*.jar
2424
ARG PLUGIN_JARS=/lowcoder-server/lowcoder-plugins/*/target/*.jar
2525

2626
# Copy Java runtime for running server

deploy/docker/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Image can be configured by setting environment variables.
3636
| `ENCRYPTION_PASSWORD` | Encryption password | `lowcoder.org` |
3737
| `ENCRYPTION_SALT` | Salt used for encrypting password | `lowcoder.org` |
3838
| `CORS_ALLOWED_DOMAINS` | CORS allowed domains | `*` |
39+
| `LOWCODER_MAX_REQUEST_SIZE` | Lowcoder max request size | `20m` |
3940
| `LOWCODER_API_SERVICE_URL` | Lowcoder API service URL | `http://localhost:8080` |
4041
| `LOWCODER_NODE_SERVICE_URL` | Lowcoder Node service (js executor) URL | `http://localhost:6060` |
4142
| `DEFAULT_ORGS_PER_USER` | Default maximum organizations per user | `100` |
@@ -121,6 +122,7 @@ Image can be configured by setting environment variables.
121122
| --------------------------------| --------------------------------------------------------------------| ------------------------------------------------------- |
122123
| `PUID` | ID of user running services. It will own all created logs and data. | `9001` |
123124
| `PGID` | ID of group of the user running services. | `9001` |
125+
| `LOWCODER_MAX_REQUEST_SIZE` | Lowcoder max request size | `20m` |
124126
| `LOWCODER_API_SERVICE_URL` | Lowcoder API service URL | `http://localhost:8080` |
125127
| `LOWCODER_NODE_SERVICE_URL` | Lowcoder Node service (js executor) URL | `http://localhost:6060` |
126128

deploy/docker/docker-compose-multi.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ services:
7575
environment:
7676
PUID: "9001"
7777
PGID: "9001"
78+
LOWCODER_MAX_REQUEST_SIZE: 20m
7879
LOWCODER_API_SERVICE_URL: "http://lowcoder-api-service:8080"
7980
LOWCODER_NODE_SERVICE_URL: "http://lowcoder-node-service:6060"
8081
restart: unless-stopped

deploy/docker/docker-compose.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ services:
3636
# api and node service parameters
3737
LOWCODER_API_SERVICE_URL: "http://localhost:8080"
3838
LOWCODER_NODE_SERVICE_URL: "http://localhost:6060"
39+
# frontend parameters
40+
LOWCODER_MAX_REQUEST_SIZE: 20m
3941
volumes:
4042
- ./lowcoder-stacks:/lowcoder-stacks
4143
restart: unless-stopped

deploy/docker/frontend/01-update-nginx-conf.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ else
1818
ln -s /etc/nginx/nginx-http.conf /etc/nginx/nginx.conf
1919
fi;
2020

21+
sed -i "s@__LOWCODER_MAX_REQUEST_SIZE__@${LOWCODER_MAX_REQUEST_SIZE:=20m}@" /etc/nginx/nginx.conf
2122
sed -i "s@__LOWCODER_API_SERVICE_URL__@${LOWCODER_API_SERVICE_URL:=http://localhost:8080}@" /etc/nginx/nginx.conf
2223
sed -i "s@__LOWCODER_NODE_SERVICE_URL__@${LOWCODER_NODE_SERVICE_URL:=http://localhost:6060}@" /etc/nginx/nginx.conf
2324

2425
echo "nginx config updated with:"
25-
echo " Lowcoder api service URL: ${LOWCODER_API_SERVICE_URL}"
26-
echo " Lowcoder node service URL: ${LOWCODER_NODE_SERVICE_URL}"
26+
echo " Lowcoder max upload size: ${LOWCODER_MAX_REQUEST_SIZE:=20m}"
27+
echo " Lowcoder api service URL: ${LOWCODER_API_SERVICE_URL:=http://localhost:8080}"
28+
echo " Lowcoder node service URL: ${LOWCODER_NODE_SERVICE_URL:=http://localhost:6060}"

deploy/docker/frontend/nginx-http.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ http {
1010

1111
include /etc/nginx/mime.types;
1212
default_type application/octet-stream;
13+
client_max_body_size __LOWCODER_MAX_REQUEST_SIZE__;
1314

1415
log_format main '"$time_local" client=$remote_addr '
1516
'method=$request_method request="$request" '

deploy/docker/frontend/nginx-https.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ http {
1010

1111
include /etc/nginx/mime.types;
1212
default_type application/octet-stream;
13+
client_max_body_size __LOWCODER_MAX_REQUEST_SIZE__;
1314

1415
log_format main '"$time_local" client=$remote_addr '
1516
'method=$request_method request="$request" '

server/api-service/lowcoder-sdk/src/main/java/org/lowcoder/sdk/config/CommonConfig.java

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
import java.util.HashSet;
77
import java.util.List;
88
import java.util.Set;
9+
import java.util.regex.Matcher;
10+
import java.util.regex.Pattern;
911

1012
import org.apache.commons.collections4.CollectionUtils;
1113
import org.apache.commons.collections4.ListUtils;
@@ -33,8 +35,9 @@ public class CommonConfig {
3335
private String version;
3436
private boolean blockHoundEnable;
3537
private String cookieName;
36-
private int maxQueryRequestSizeInMb = 10;
37-
private int maxQueryResponseSizeInMb = 10;
38+
private String maxUploadSize = "20MB";
39+
private String maxQueryRequestSize = "20MB";
40+
private String maxQueryResponseSize = "20MB";
3841
private Query query = new Query();
3942
private Cookie cookie = new Cookie();
4043
private JsExecutor jsExecutor = new JsExecutor();
@@ -48,6 +51,37 @@ public boolean isEnterpriseMode() {
4851
return workspace.getMode() == WorkspaceMode.ENTERPRISE;
4952
}
5053

54+
private static final Pattern HUMAN_DATA_SIZE_PATTERN = Pattern.compile("^([ \t]*)(?<number>\\d+(\\.\\d+)?)([ \t]*)(?<unit>[kKmMgGtT]{1})?([bB \t]*)$");
55+
public static String normalizeDataUnits(String dataWithUnits)
56+
{
57+
String normalized = dataWithUnits;
58+
Matcher m = HUMAN_DATA_SIZE_PATTERN.matcher(dataWithUnits);
59+
if (m.matches())
60+
{
61+
normalized = m.group("number");
62+
if (StringUtils.isNotBlank(m.group("unit")))
63+
{
64+
normalized += m.group("unit").toUpperCase() + "B";
65+
}
66+
}
67+
return normalized;
68+
}
69+
70+
public void setMaxUploadSize(String size)
71+
{
72+
this.maxUploadSize = normalizeDataUnits(size);
73+
}
74+
75+
public void setMaxQueryRequestSize(String size)
76+
{
77+
this.maxQueryRequestSize = normalizeDataUnits(size);
78+
}
79+
80+
public void setMaxQueryResponseSize(String size)
81+
{
82+
this.maxQueryResponseSize = normalizeDataUnits(size);
83+
}
84+
5185
@Data
5286
public static class Domain {
5387
private String defaultValue;

server/api-service/lowcoder-server/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@
153153
<artifactId>json-path</artifactId>
154154
</dependency>
155155
<dependency>
156-
<groupId>javax.servlet</groupId>
157-
<artifactId>javax.servlet-api</artifactId>
156+
<groupId>jakarta.servlet</groupId>
157+
<artifactId>jakarta.servlet-api</artifactId>
158158
</dependency>
159159

160160
<dependency>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package org.lowcoder.api.framework.configuration;
2+
3+
import org.lowcoder.sdk.config.CommonConfig;
4+
import org.springframework.beans.factory.annotation.Autowired;
5+
import org.springframework.boot.web.servlet.MultipartConfigFactory;
6+
import org.springframework.context.annotation.Bean;
7+
import org.springframework.context.annotation.Configuration;
8+
import org.springframework.util.unit.DataSize;
9+
10+
import jakarta.servlet.MultipartConfigElement;
11+
12+
@Configuration
13+
public class ApplicationConfiguration
14+
{
15+
@Autowired
16+
private CommonConfig common;
17+
18+
@Bean
19+
public MultipartConfigElement multipartConfigElement()
20+
{
21+
MultipartConfigFactory factory = new MultipartConfigFactory();
22+
factory.setMaxRequestSize(DataSize.parse(common.getMaxUploadSize()));
23+
factory.setMaxFileSize(DataSize.parse(common.getMaxUploadSize()));
24+
return factory.createMultipartConfig();
25+
}
26+
}

0 commit comments

Comments
 (0)