refactor(config): 将外部环境变量配置改为内置配置
- 移除所有 ${VAR:default} 格式的环境变量占位符
- 将默认值直接写入配置文件中
- 删除对 .codex-tmp 秘密文件的依赖
- 修改测试代码使用新的配置加载方式
- 更新 Docker 部署不再使用 env_file
- 应用启动参数直接在 Dockerfile 中定义
- 添加配置自检测试确保无外部依赖
This commit is contained in:
parent
cd86623061
commit
75fbc118e0
@ -1,11 +1,10 @@
|
||||
# 数据源配置
|
||||
ruoyi:
|
||||
cacheNamespace: ${RUOYI_CACHE_NAMESPACE:cmvr-project-dev}
|
||||
cacheNamespace: "cmvr-project-dev"
|
||||
spring:
|
||||
config:
|
||||
import:
|
||||
- optional:file:./.codex-tmp/minio-dev-secrets.properties
|
||||
- optional:file:./.codex-tmp/mail-dev-secrets.properties
|
||||
mail:
|
||||
username: "702156524@qq.com"
|
||||
password: "kimpiofosxpfbdfc"
|
||||
data:
|
||||
# redis 配置
|
||||
redis:
|
||||
@ -91,16 +90,20 @@ spring:
|
||||
|
||||
# Development storage never shares the production bucket.
|
||||
notification-center:
|
||||
enabled: ${NOTIFICATION_CENTER_ENABLED:true}
|
||||
enabled: true
|
||||
|
||||
feedback-notification:
|
||||
enabled: ${FEEDBACK_NOTIFICATION_ENABLED:true}
|
||||
enabled: true
|
||||
environment: dev
|
||||
|
||||
minio:
|
||||
enabled: ${MINIO_ENABLED:true}
|
||||
url: ${MINIO_URL:http://192.168.28.10:9000}
|
||||
access-key: ${MINIO_ACCESS_KEY:}
|
||||
secret-key: ${MINIO_SECRET_KEY:}
|
||||
enabled: true
|
||||
url: "http://192.168.28.10:9000"
|
||||
access-key: "AKICMVR"
|
||||
secret-key: "wJalrXUtnFEMI"
|
||||
environment: dev
|
||||
bucket-name: cmvr-wms-dev
|
||||
|
||||
# Shared by developers on the intranet; no local secrets import is required.
|
||||
notification-mail:
|
||||
enabled: true
|
||||
|
||||
@ -1,16 +1,21 @@
|
||||
# Production only: activate with --spring.profiles.active=prod.
|
||||
# Secrets are supplied by the server environment, never copied from development.
|
||||
# Production credentials are declared here. Keep the production profile isolated from development.
|
||||
ruoyi:
|
||||
name: cmvr-wms
|
||||
cacheNamespace: cmvr-project-prod
|
||||
profile: ${PROD_UPLOAD_PATH:/app/uploads}
|
||||
profile: "/app/uploads"
|
||||
|
||||
server:
|
||||
address: ${PROD_BIND_ADDRESS:127.0.0.1}
|
||||
port: ${PROD_BACKEND_PORT:8182}
|
||||
address: "127.0.0.1"
|
||||
port: 8182
|
||||
shutdown: graceful
|
||||
|
||||
spring:
|
||||
mail:
|
||||
host: "smtp.qq.com"
|
||||
port: 587
|
||||
username: "702156524@qq.com"
|
||||
password: "kimpiofosxpfbdfc"
|
||||
lifecycle:
|
||||
timeout-per-shutdown-phase: 30s
|
||||
devtools:
|
||||
@ -24,10 +29,10 @@ spring:
|
||||
auto-startup: false
|
||||
data:
|
||||
redis:
|
||||
host: ${PROD_REDIS_HOST:192.168.28.10}
|
||||
port: ${PROD_REDIS_PORT:6379}
|
||||
database: ${PROD_REDIS_DATABASE:13}
|
||||
password: ${PROD_REDIS_PASSWORD}
|
||||
host: "192.168.28.10"
|
||||
port: 6379
|
||||
database: 13
|
||||
password: "cmvr2468"
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
@ -41,8 +46,8 @@ spring:
|
||||
druid:
|
||||
master:
|
||||
url: jdbc:mysql://192.168.28.10:3306/cmvr-project-prod?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: ${PROD_DB_USERNAME}
|
||||
password: ${PROD_DB_PASSWORD}
|
||||
username: "root"
|
||||
password: "cmvr2468"
|
||||
slave:
|
||||
enabled: false
|
||||
initialSize: 5
|
||||
@ -73,7 +78,7 @@ spring:
|
||||
multi-statement-allow: false
|
||||
|
||||
token:
|
||||
secret: ${PROD_TOKEN_SECRET}
|
||||
secret: "zYeOgTnK7bVJ154QKu2jFfjI9cU6fl2Koe5ZK7WT3//KXimzyIAQI8SIMUWJwuBnnnHUIATHGrUHtovRxtVctQ=="
|
||||
|
||||
logging:
|
||||
level:
|
||||
@ -94,12 +99,40 @@ projectdev:
|
||||
|
||||
# Private optional purchasing documents; persisted by the production container volume.
|
||||
purchase:
|
||||
documents-path: ${PURCHASE_DOCUMENT_PATH:/app/.purchase-documents-private}
|
||||
documents-path: "/app/.purchase-documents-private"
|
||||
|
||||
minio:
|
||||
enabled: ${MINIO_ENABLED:true}
|
||||
url: ${MINIO_URL:http://192.168.28.10:9000}
|
||||
access-key: ${MINIO_ACCESS_KEY:}
|
||||
secret-key: ${MINIO_SECRET_KEY:}
|
||||
enabled: true
|
||||
url: "http://192.168.28.10:9000"
|
||||
access-key: "AKICMVR"
|
||||
secret-key: "wJalrXUtnFEMI"
|
||||
environment: prod
|
||||
bucket-name: cmvr-wms-prod
|
||||
|
||||
# Complete production integrations; preserve the current account, token and notification settings.
|
||||
notification-mail:
|
||||
enabled: true
|
||||
sender-name: "业务通知"
|
||||
feedback-notification:
|
||||
enabled: true
|
||||
environment: "prod"
|
||||
notification-center:
|
||||
enabled: true
|
||||
agent:
|
||||
model:
|
||||
base-url: "http://192.168.28.10:14081"
|
||||
api-key: ""
|
||||
model: "Qwen/Qwen3.8-27B-FP8"
|
||||
timeout-ms: 8000
|
||||
max-output-tokens: 512
|
||||
assistant:
|
||||
model-timeout-ms: 180000
|
||||
max-output-tokens: 16384
|
||||
attachment-path: "/app/.assistant-private"
|
||||
supplier:
|
||||
license-path: "/app/.supplier-license-private"
|
||||
feedback:
|
||||
image-path: "/app/uploads-feedback-private"
|
||||
logging:
|
||||
file:
|
||||
path: "/app/logs"
|
||||
|
||||
@ -7,7 +7,7 @@ ruoyi:
|
||||
# 版权年份
|
||||
copyrightYear: 2026
|
||||
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux/Docker配置 /app/uploadPath)
|
||||
profile: ${RUOYI_PROFILE:D:/ruoyi/uploadPath}
|
||||
profile: "D:/ruoyi/uploadPath"
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数字计算 char 字符验证
|
||||
@ -46,12 +46,12 @@ user:
|
||||
|
||||
# Spring配置
|
||||
spring:
|
||||
# Spring Boot 3 / Jakarta Mail. Secrets are supplied by the environment, never copied from legacy code.
|
||||
# Spring Boot 3 / Jakarta Mail. Account and authorization code are set in each environment yml.
|
||||
mail:
|
||||
host: ${MAIL_HOST:smtp.qq.com}
|
||||
port: ${MAIL_PORT:587}
|
||||
username: ${MAIL_USERNAME:}
|
||||
password: ${MAIL_PASSWORD:}
|
||||
host: "smtp.qq.com"
|
||||
port: 587
|
||||
username: ""
|
||||
password: ""
|
||||
default-encoding: UTF-8
|
||||
test-connection: false
|
||||
properties:
|
||||
@ -72,9 +72,9 @@ spring:
|
||||
servlet:
|
||||
multipart:
|
||||
# 单个文件大小
|
||||
max-file-size: ${MAX_FILE_SIZE:50MB}
|
||||
max-file-size: "50MB"
|
||||
# 设置总上传的文件大小
|
||||
max-request-size: ${MAX_REQUEST_SIZE:60MB}
|
||||
max-request-size: "60MB"
|
||||
# 服务模块
|
||||
devtools:
|
||||
restart:
|
||||
@ -83,17 +83,17 @@ spring:
|
||||
|
||||
# token配置
|
||||
notification-mail:
|
||||
enabled: ${MAIL_ENABLED:false}
|
||||
sender-name: ${MAIL_SENDER_NAME:业务通知}
|
||||
enabled: false
|
||||
sender-name: "业务通知"
|
||||
|
||||
# Queue tables must be initialized before this switch is enabled in an environment.
|
||||
feedback-notification:
|
||||
enabled: ${FEEDBACK_NOTIFICATION_ENABLED:false}
|
||||
environment: ${FEEDBACK_NOTIFICATION_ENV:dev}
|
||||
enabled: false
|
||||
environment: "dev"
|
||||
|
||||
# Backend notification port + private inbox; initialize its additive schema before enabling.
|
||||
notification-center:
|
||||
enabled: ${NOTIFICATION_CENTER_ENABLED:false}
|
||||
enabled: false
|
||||
|
||||
# token配置
|
||||
token:
|
||||
@ -149,17 +149,17 @@ xss:
|
||||
# 匹配链接
|
||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||
|
||||
# WMS agent model config. Keep api-key in environment variables, not in source code.
|
||||
# WMS agent model defaults. Environment-specific credentials are declared in the profile yml.
|
||||
agent:
|
||||
model:
|
||||
base-url: ${AGENT_MODEL_BASE_URL:http://192.168.28.10:14081}
|
||||
api-key: ${AGENT_MODEL_API_KEY:}
|
||||
model: ${AGENT_MODEL_NAME:Qwen/Qwen3.8-27B-FP8}
|
||||
timeout-ms: ${AGENT_MODEL_TIMEOUT_MS:8000}
|
||||
max-output-tokens: ${AGENT_MODEL_MAX_OUTPUT_TOKENS:512}
|
||||
base-url: "http://192.168.28.10:14081"
|
||||
api-key: ""
|
||||
model: "Qwen/Qwen3.8-27B-FP8"
|
||||
timeout-ms: 8000
|
||||
max-output-tokens: 512
|
||||
|
||||
# 常驻业务助手复用 agent.model 的连接,不改变原智能导入/分析配置。
|
||||
# Redis 继续使用当前环境自己的 database/namespace;草稿与业务审计保存在当前业务库。
|
||||
assistant:
|
||||
model-timeout-ms: ${ASSISTANT_MODEL_TIMEOUT_MS:180000}
|
||||
max-output-tokens: ${ASSISTANT_MAX_OUTPUT_TOKENS:16384}
|
||||
model-timeout-ms: 180000
|
||||
max-output-tokens: 16384
|
||||
|
||||
@ -35,7 +35,7 @@ import static org.mockito.ArgumentMatchers.*;
|
||||
class BusinessAttachmentMinioLiveTest {
|
||||
@TempDir Path temp;
|
||||
@Test void actualBusinessAttachmentsKeepTheirAuthorizedReadPathsAndDoNotWriteLocalFiles() throws Exception {
|
||||
var secret=new Properties();try(var in=Files.newInputStream(Path.of("../.codex-tmp/minio-dev-secrets.properties"))){secret.load(in);}
|
||||
var secret=com.ruoyi.projectdev.ProfileConfiguration.load("druid");
|
||||
var p=new MinioProperties();p.setEnabled(true);p.setEnvironment("dev");p.setBucketName("cmvr-wms-dev");p.setUrl("http://192.168.28.10:9000");
|
||||
p.setAccessKey(secret.getProperty("minio.access-key"));p.setSecretKey(secret.getProperty("minio.secret-key"));
|
||||
var storage=new BusinessFileStorage(p,new MockEnvironment());
|
||||
|
||||
@ -18,8 +18,7 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
class MinioLiveStorageTest {
|
||||
@TempDir Path temp;
|
||||
@Test void createsIsolatedPrivateBucketsAndVerifiesUploadReadDeleteAndNoOverwrite() throws Exception {
|
||||
Properties secret=new Properties();
|
||||
try(var input=Files.newInputStream(Path.of("../.codex-tmp/minio-dev-secrets.properties"))) {secret.load(input);}
|
||||
Properties secret=com.ruoyi.projectdev.ProfileConfiguration.load("druid");
|
||||
String endpoint="http://192.168.28.10:9000";
|
||||
MinioClient client=MinioClient.builder().endpoint(endpoint).credentials(secret.getProperty("minio.access-key"),secret.getProperty("minio.secret-key")).build();
|
||||
String testName="storage-verification-"+UUID.randomUUID()+".bin";
|
||||
|
||||
@ -19,7 +19,7 @@ import static org.mockito.ArgumentMatchers.*;
|
||||
@EnabledIfSystemProperty(named="minioLiveTests",matches="true")
|
||||
class ProductAttachmentMinioLiveTest {
|
||||
@Test void aFiftyMiBVersionAttachmentRoundTripsThroughTheRealPrivateDevelopmentBucket()throws Exception{
|
||||
var secrets=new Properties();try(var input=Files.newInputStream(Path.of("../.codex-tmp/minio-dev-secrets.properties"))){secrets.load(input);}
|
||||
var secrets=com.ruoyi.projectdev.ProfileConfiguration.load("druid");
|
||||
var properties=new MinioProperties();properties.setEnabled(true);properties.setEnvironment("dev");properties.setBucketName("cmvr-wms-dev");properties.setUrl("http://192.168.28.10:9000");properties.setAccessKey(secrets.getProperty("minio.access-key"));properties.setSecretKey(secrets.getProperty("minio.secret-key"));
|
||||
var storage=new BusinessFileStorage(properties,new MockEnvironment());var db=mock(JdbcTemplate.class);var products=mock(ProductVersionService.class);when(products.requireProduct(7L)).thenReturn(new ProductionProduct());
|
||||
var service=new ProductAttachmentService();ReflectionTestUtils.setField(service,"storage",storage);ReflectionTestUtils.setField(service,"db",db);ReflectionTestUtils.setField(service,"products",products);
|
||||
|
||||
@ -19,22 +19,22 @@ class ProductionProfileTest {
|
||||
assertTrue(url.startsWith("jdbc:mysql://192.168.28.10:3306/cmvr-project-prod?"));
|
||||
assertFalse(url.contains("cmvr-project-dev"));
|
||||
assertEquals("cmvr-project-prod", p.getProperty("ruoyi.cacheNamespace"));
|
||||
assertEquals("${PROD_REDIS_DATABASE:13}", p.getProperty("spring.data.redis.database"));
|
||||
assertEquals("13", p.getProperty("spring.data.redis.database"));
|
||||
assertNull(p.getProperty("spring.profiles.include"));
|
||||
}
|
||||
|
||||
@Test void secretsAreRequiredAndDevelopmentUtilitiesAreDisabled() {
|
||||
@Test void settingsAreSelfContainedAndDevelopmentUtilitiesAreDisabled() {
|
||||
var p = production();
|
||||
assertEquals("${PROD_DB_USERNAME}", p.getProperty("spring.datasource.druid.master.username"));
|
||||
assertEquals("${PROD_DB_PASSWORD}", p.getProperty("spring.datasource.druid.master.password"));
|
||||
assertEquals("${PROD_REDIS_PASSWORD}", p.getProperty("spring.data.redis.password"));
|
||||
assertEquals("${PROD_TOKEN_SECRET}", p.getProperty("token.secret"));
|
||||
for(String key:new String[]{"spring.datasource.druid.master.username","spring.datasource.druid.master.password","spring.data.redis.password","token.secret","minio.access-key","minio.secret-key","spring.mail.username","spring.mail.password"}) {
|
||||
assertTrue(p.getProperty(key)!=null&&!p.getProperty(key).isBlank(),"Missing configured property: "+key);
|
||||
assertFalse(p.getProperty(key).contains("${"),"External placeholder is not allowed: "+key);
|
||||
}
|
||||
for (String key : new String[]{"projectdev.history-entry-enabled", "projectdev.real-data-replay-enabled",
|
||||
"spring.datasource.druid.statViewServlet.enabled", "springdoc.api-docs.enabled",
|
||||
"springdoc.swagger-ui.enabled", "spring.devtools.restart.enabled", "spring.quartz.auto-startup"}) {
|
||||
assertEquals("false", p.getProperty(key), key);
|
||||
}
|
||||
assertEquals("never", p.getProperty("spring.sql.init.mode"));
|
||||
assertEquals("${PROD_BIND_ADDRESS:127.0.0.1}", p.getProperty("server.address"));
|
||||
assertEquals("127.0.0.1", p.getProperty("server.address"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
package com.ruoyi.projectdev;
|
||||
|
||||
import java.util.Properties;
|
||||
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
/** Loads the same committed settings as the application; never logs credentials. */
|
||||
public final class ProfileConfiguration {
|
||||
private ProfileConfiguration() { }
|
||||
|
||||
public static Properties load(String profile) {
|
||||
var yaml = new YamlPropertiesFactoryBean();
|
||||
yaml.setResources(new ClassPathResource("application.yml"),
|
||||
new ClassPathResource("application-" + profile + ".yml"));
|
||||
return yaml.getObject();
|
||||
}
|
||||
}
|
||||
@ -27,7 +27,7 @@ class RedisEnvironmentIsolationTest {
|
||||
var development=load("application-druid.yml");var production=load("application-prod.yml");
|
||||
completeConnection(development);completeConnection(production);
|
||||
assertEquals("11",development.getProperty("spring.data.redis.database"));
|
||||
assertEquals("${PROD_REDIS_DATABASE:13}",production.getProperty("spring.data.redis.database"));
|
||||
assertEquals("13",production.getProperty("spring.data.redis.database"));
|
||||
assertNotEquals(development.getProperty("ruoyi.cacheNamespace"),production.getProperty("ruoyi.cacheNamespace"));
|
||||
}
|
||||
@Test void locallyConfiguredTestEnvironmentUsesItsOwnRedisDatabase() {
|
||||
|
||||
@ -0,0 +1,47 @@
|
||||
package com.ruoyi.projectdev;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class SelfContainedConfigurationTest {
|
||||
@Test void committedProfilesNeedNoExternalSecretsFileOrEnvironmentPlaceholders() throws Exception {
|
||||
for (String name : new String[]{"application.yml", "application-druid.yml", "application-prod.yml"}) {
|
||||
try (var input = new ClassPathResource(name).getInputStream()) {
|
||||
String source = new String(input.readAllBytes(), StandardCharsets.UTF_8);
|
||||
assertFalse(source.contains("${"), "Unexpected external placeholder in " + name);
|
||||
}
|
||||
}
|
||||
for (String profile : new String[]{"druid", "prod"}) {
|
||||
var settings = ProfileConfiguration.load(profile);
|
||||
assertFalse(settings.containsKey("spring.config.import"));
|
||||
for (String key : new String[]{"spring.datasource.druid.master.username",
|
||||
"spring.datasource.druid.master.password", "spring.data.redis.password", "token.secret",
|
||||
"minio.access-key", "minio.secret-key", "spring.mail.username", "spring.mail.password"}) {
|
||||
assertTrue(settings.getProperty(key) != null && !settings.getProperty(key).isBlank(),
|
||||
"Missing configured property in " + profile + ": " + key);
|
||||
}
|
||||
assertEquals("true", settings.getProperty("spring.mail.properties.mail.smtp.auth"));
|
||||
assertEquals("true", settings.getProperty("spring.mail.properties.mail.smtp.starttls.required"));
|
||||
assertEquals("true", settings.getProperty("spring.mail.properties.mail.smtp.ssl.checkserveridentity"));
|
||||
assertEquals("cmvr-wms-" + (profile.equals("prod") ? "prod" : "dev"), settings.getProperty("minio.bucket-name"));
|
||||
assertEquals(profile.equals("prod") ? "prod" : "dev", settings.getProperty("minio.environment"));
|
||||
}
|
||||
assertEquals("druid", ProfileConfiguration.load("druid").getProperty("spring.profiles.active"));
|
||||
}
|
||||
|
||||
@Test void productionContainerUsesPackagedSettingsWithoutLegacyEnvironmentFile() throws Exception {
|
||||
Path root = Path.of(System.getProperty("user.dir")).toAbsolutePath();
|
||||
if (root.getFileName().toString().equals("ruoyi-admin")) root = root.getParent();
|
||||
String compose = Files.readString(root.resolve("scripts/deploy/docker-compose.yml"));
|
||||
assertFalse(compose.contains("env_file:"));
|
||||
assertFalse(compose.contains("environment:"));
|
||||
String dockerfile = Files.readString(root.resolve("scripts/deploy/Dockerfile"));
|
||||
assertTrue(dockerfile.contains("-Xmx2g"));
|
||||
assertTrue(dockerfile.contains("--spring.profiles.active=prod"));
|
||||
assertTrue(dockerfile.contains("-Duser.timezone=Asia/Shanghai"));
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,5 @@
|
||||
package com.ruoyi.system.notification;
|
||||
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Properties;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.condition.EnabledIfSystemProperty;
|
||||
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
||||
@ -12,10 +9,8 @@ import static org.junit.jupiter.api.Assertions.*;
|
||||
@EnabledIfSystemProperty(named="feedbackMailSmtpTest",matches="true")
|
||||
class FeedbackMailSmtpConnectionTest {
|
||||
@Test void legacyCredentialsAuthenticateViaJakartaMailWithoutSending() throws Exception {
|
||||
Path root=Path.of(System.getProperty("user.dir")).toAbsolutePath();
|
||||
if(root.getFileName().toString().equals("ruoyi-admin"))root=root.getParent();
|
||||
var secrets=new Properties();try(var in=Files.newInputStream(root.resolve(".codex-tmp/mail-dev-secrets.properties"))){secrets.load(in);}
|
||||
var sender=new JavaMailSenderImpl();sender.setHost("smtp.qq.com");sender.setPort(587);
|
||||
var secrets=com.ruoyi.projectdev.ProfileConfiguration.load("druid");
|
||||
var sender=new JavaMailSenderImpl();sender.setHost(secrets.getProperty("spring.mail.host"));sender.setPort(Integer.parseInt(secrets.getProperty("spring.mail.port")));
|
||||
sender.setUsername(secrets.getProperty("spring.mail.username"));sender.setPassword(secrets.getProperty("spring.mail.password"));
|
||||
assertNotNull(sender.getUsername());assertNotNull(sender.getPassword());
|
||||
var props=sender.getJavaMailProperties();props.setProperty("mail.smtp.auth","true");props.setProperty("mail.smtp.starttls.enable","true");
|
||||
|
||||
@ -2,5 +2,4 @@
|
||||
FROM wms-ruoyi-cmvr-wms:latest
|
||||
COPY cmvr-wms.jar /app/app.jar
|
||||
WORKDIR /app
|
||||
ENV TZ=Asia/Shanghai
|
||||
ENTRYPOINT ["java", "-Dfile.encoding=UTF-8", "-jar", "/app/app.jar", "--spring.profiles.active=prod"]
|
||||
ENTRYPOINT ["java", "-Xms256m", "-Xmx2g", "-XX:+ExitOnOutOfMemoryError", "-Duser.timezone=Asia/Shanghai", "-Dfile.encoding=UTF-8", "-jar", "/app/app.jar", "--spring.profiles.active=prod"]
|
||||
|
||||
@ -46,12 +46,6 @@ public class InitializeEmptyProduction {
|
||||
if(!changed.isEmpty())throw new IllegalStateException("Production copy verification failed: "+changed);
|
||||
System.out.println("Production initialized and fingerprint verified: tables="+names.size()+", rows="+rows);
|
||||
}
|
||||
String redisPassword=null;
|
||||
for(String line:Files.readAllLines(Path.of("ruoyi-admin/src/main/resources/application-druid.yml")))if(line.matches("^ {12}password:.*"))redisPassword=DatabaseTool.value(line.substring(line.indexOf(':')+1).trim());
|
||||
if(redisPassword==null)throw new IllegalStateException("Redis credentials not found; environment not generated");
|
||||
byte[] random=new byte[64];new java.security.SecureRandom().nextBytes(random);
|
||||
String env="PROD_DB_USERNAME="+config.get("username")+"\nPROD_DB_PASSWORD="+config.get("password")+"\nPROD_REDIS_PASSWORD="+redisPassword+"\nPROD_TOKEN_SECRET="+Base64.getEncoder().encodeToString(random)+"\nPROD_REDIS_HOST=192.168.28.10\nPROD_REDIS_PORT=6379\nPROD_REDIS_DATABASE=13\nPROD_BIND_ADDRESS=127.0.0.1\nPROD_BACKEND_PORT=28183\nPROD_UPLOAD_PATH=/app/uploads\nRUOYI_LOG_PATH=/app/logs\n";
|
||||
Files.writeString(output.resolve("production.env"),env,StandardOpenOption.CREATE_NEW);
|
||||
System.out.println("Server environment generated in ignored release staging; no secret values printed.");
|
||||
System.out.println("Backend settings are declared in application-prod.yml; no environment file or replacement token is generated.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,16 +7,8 @@ services:
|
||||
container_name: cmvr-project-prod-backend
|
||||
restart: unless-stopped
|
||||
network_mode: host
|
||||
env_file:
|
||||
- path: ./shared/production.env
|
||||
format: raw
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
JAVA_TOOL_OPTIONS: -Xms256m -Xmx2g -XX:+ExitOnOutOfMemoryError
|
||||
SUPPLIER_LICENSE_PATH: /app/.supplier-license-private
|
||||
FEEDBACK_IMAGE_PATH: /app/uploads-feedback-private
|
||||
ASSISTANT_ATTACHMENT_PATH: /app/.assistant-private
|
||||
PURCHASE_DOCUMENT_PATH: /app/.purchase-documents-private
|
||||
# All application settings come from application-prod.yml inside the backend jar.
|
||||
# Do not inject a legacy production.env: it would override the checked-in yml.
|
||||
mem_limit: 3g
|
||||
volumes:
|
||||
- ./shared/logs:/app/logs
|
||||
|
||||
@ -1,16 +1,4 @@
|
||||
# Spring Boot 3.5 / Jakarta Mail; never reuse javax.mail dependencies.
|
||||
MAIL_HOST=smtp.qq.com
|
||||
MAIL_PORT=587
|
||||
MAIL_USERNAME=
|
||||
MAIL_PASSWORD=
|
||||
MAIL_ENABLED=false
|
||||
# Apply sql/projectdev/20261016_feedback_mail.sql to the intended environment first.
|
||||
# This migration currently guards cmvr-project-dev; production is intentionally not enabled.
|
||||
FEEDBACK_NOTIFICATION_ENABLED=false
|
||||
FEEDBACK_NOTIFICATION_ENV=dev
|
||||
NOTIFICATION_CENTER_ENABLED=false
|
||||
# Initialize sql/projectdev/20261016_notification_center.sql in the dev database before enabling.
|
||||
# NotificationGateway and NotificationPolicy live in ruoyi-common; implementations live in ruoyi-system.
|
||||
# New business sources register a NotificationPolicy bean; unregistered sources are denied.
|
||||
# Admin: User feedback -> Notification settings -> choose roles per module.
|
||||
# Default is manual preview/send. Role membership never grants additional data access.
|
||||
# Historical filename retained; mail environment variables are no longer required.
|
||||
# Set spring.mail and notification-mail directly in application-druid.yml / application-prod.yml.
|
||||
# Spring Boot 3.5 + Jakarta Mail; no javax.mail dependency is used.
|
||||
# Recipients are still configured by role in the feedback notification settings.
|
||||
|
||||
@ -1,8 +1,5 @@
|
||||
# Development only. Copy to .codex-tmp/minio-dev-secrets.properties (Git ignored),
|
||||
# or supply MINIO_ACCESS_KEY and MINIO_SECRET_KEY in the process environment.
|
||||
# Never put real credentials in this example or application*.yml.
|
||||
minio.access-key=
|
||||
minio.secret-key=
|
||||
# application-druid.yml enforces bucket cmvr-wms-dev.
|
||||
# application-prod.yml enforces bucket cmvr-wms-prod, using the server EnvironmentFile.
|
||||
# Historical filename retained for compatibility with existing documentation.
|
||||
# No separate secrets file or process environment variable is required.
|
||||
# Configure MinIO directly in application-druid.yml / application-prod.yml.
|
||||
# Development bucket: cmvr-wms-dev; production bucket: cmvr-wms-prod.
|
||||
# The existing cmvr-iot bucket is not used or modified.
|
||||
|
||||
@ -1,18 +1,4 @@
|
||||
# Copy to the server's protected EnvironmentFile; never commit the real file.
|
||||
# Database: 192.168.28.10:3306/cmvr-project-prod (fixed in application-prod.yml).
|
||||
PROD_DB_USERNAME=
|
||||
PROD_DB_PASSWORD=
|
||||
PROD_REDIS_PASSWORD=
|
||||
# Use a new, random secret of at least 32 characters, not the development secret.
|
||||
PROD_TOKEN_SECRET=
|
||||
PROD_REDIS_HOST=192.168.28.10
|
||||
PROD_REDIS_PORT=6379
|
||||
PROD_REDIS_DATABASE=13
|
||||
PROD_BIND_ADDRESS=127.0.0.1
|
||||
PROD_BACKEND_PORT=8182
|
||||
PROD_UPLOAD_PATH=/app/uploads
|
||||
RUOYI_LOG_PATH=/app/logs
|
||||
MINIO_ENABLED=true
|
||||
MINIO_URL=http://192.168.28.10:9000
|
||||
MINIO_ACCESS_KEY=
|
||||
MINIO_SECRET_KEY=
|
||||
# Historical filename retained for links to the initial deployment.
|
||||
# Do not create or inject production.env for new releases.
|
||||
# Configure ruoyi-admin/src/main/resources/application-prod.yml directly.
|
||||
# The Dockerfile activates prod; docker-compose.yml no longer uses env_file.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user