Comments (6)
- 从下列打包可以看出,执行
mvn clean install
后,原来配置文件中是[email protected]@.yml
,打包后的产物是application-dev.yml
- 也就是说,打包后的产物配置固定了,无法在程序启动时通过
参数 -Pxxx
修改配置了 - 只能在打包时指定
参数 -Pxxx
,也就是说,一个包可能只能在一个环境中使用,如果配置发生了变化,也只能通过重新打包来解决此问题(启动时,全部使用参数进行指定是不现实的做法)
xuxiaowei@DESKTOP-8E6LUNV MINGW64 /d/IdeaProjects-jihulab.com/mirrors-gitee/log4j/pig (jdk17-dev)
$ mvn clean install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] pig [pom]
[INFO] pig-register [jar]
[INFO] pig-common [pom]
[INFO] pig-common-core [jar]
[INFO] pig-gateway [jar]
[INFO] pig-common-feign [jar]
[INFO] pig-common-mybatis [jar]
[INFO] pig-upms [pom]
[INFO] pig-upms-api [jar]
[INFO] pig-common-security [jar]
[INFO] pig-common-log [jar]
[INFO] pig-auth [jar]
[INFO] pig-common-oss [jar]
[INFO] pig-common-swagger [jar]
[INFO] pig-common-xss [jar]
[INFO] pig-upms-biz [jar]
[INFO] pig-common-bom [pom]
[INFO] pig-common-datasource [jar]
[INFO] pig-common-job [jar]
[INFO] pig-common-seata [jar]
[INFO] pig-visual [pom]
[INFO] pig-codegen [jar]
[INFO] pig-monitor [jar]
[INFO] pig-quartz [jar]
[INFO]
[INFO] -------------------------< com.pig4cloud:pig >--------------------------
[INFO] Building pig 3.7.1 [1/24]
******
[INFO] Reactor Summary for pig 3.7.1:
[INFO]
[INFO] pig ................................................ SUCCESS [ 0.442 s]
[INFO] pig-register ....................................... SUCCESS [ 13.649 s]
[INFO] pig-common ......................................... SUCCESS [ 0.030 s]
[INFO] pig-common-core .................................... SUCCESS [ 3.235 s]
[INFO] pig-gateway ........................................ SUCCESS [ 3.748 s]
[INFO] pig-common-feign ................................... SUCCESS [ 1.440 s]
[INFO] pig-common-mybatis ................................. SUCCESS [ 1.348 s]
[INFO] pig-upms ........................................... SUCCESS [ 0.025 s]
[INFO] pig-upms-api ....................................... SUCCESS [ 2.419 s]
[INFO] pig-common-security ................................ SUCCESS [ 2.406 s]
[INFO] pig-common-log ..................................... SUCCESS [ 1.427 s]
[INFO] pig-auth ........................................... SUCCESS [ 2.966 s]
[INFO] pig-common-bom ..................................... SUCCESS [ 0.022 s]
[INFO] pig-common-datasource .............................. SUCCESS [ 0.869 s]
[INFO] pig-common-job ..................................... SUCCESS [ 0.906 s]
[INFO] pig-common-seata ................................... SUCCESS [ 0.874 s]
[INFO] pig-visual ......................................... SUCCESS [ 0.021 s]
[INFO] pig-codegen ........................................ SUCCESS [ 3.004 s]
[INFO] pig-monitor ........................................ SUCCESS [ 1.229 s]
[INFO] pig-quartz ......................................... SUCCESS [ 2.619 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 50.726 s
[INFO] Finished at: 2023-09-01T10:15:41+08:00
[INFO] ------------------------------------------------------------------------
xuxiaowei@DESKTOP-8E6LUNV MINGW64 /d/IdeaProjects-jihulab.com/mirrors-gitee/log4j/pig (jdk17-dev)
$ cat pig-gateway/src/main/resources/application.yml
server:
port: 9999
spring:
application:
name: @artifactId@
cloud:
nacos:
username: @nacos.username@
password: @nacos.password@
discovery:
server-addr: ${NACOS_HOST:pig-register}:${NACOS_PORT:8848}
watch:
enabled: true
watch-delay: 1000
config:
server-addr: ${spring.cloud.nacos.discovery.server-addr}
config:
import:
- optional:nacos:[email protected]@.yml
- optional:nacos:${spring.application.name}[email protected]@.yml
xuxiaowei@DESKTOP-8E6LUNV MINGW64 /d/IdeaProjects-jihulab.com/mirrors-gitee/log4j/pig (jdk17-dev)
$ cat pig-gateway/target/classes/application.yml
server:
port: 9999
spring:
application:
name: pig-gateway
cloud:
nacos:
username: nacos
password: nacos
discovery:
server-addr: ${NACOS_HOST:pig-register}:${NACOS_PORT:8848}
watch:
enabled: true
watch-delay: 1000
config:
server-addr: ${spring.cloud.nacos.discovery.server-addr}
config:
import:
- optional:nacos:application-dev.yml
- optional:nacos:${spring.application.name}-dev.yml
xuxiaowei@DESKTOP-8E6LUNV MINGW64 /d/IdeaProjects-jihulab.com/mirrors-gitee/log4j/pig (jdk17-dev)
$
from pig.
统一代码配置
from pig.
十二要素宣言:https://12factor.net/zh_cn/
from pig.
测试环境已通过,正式环境需要重新打包,如何保证正式环境的打包产物与测试环境相同?
- Maven 快照随时能修改、删除:在测试打包后,正式打包前,Maven 快照可能发生变化
- npm 包随时能修改、删除:在测试打包后,正式打包前,npm 包发生了变化
- docker 镜像随时能修改、删除:在测试打包后,正式打包前,docker 镜像发生了变化
- ......
from pig.
给 nacos 指定一个 namespace,从环境变量中去读取,就可以实现一份代码多端部署了吧。配置都放到了 nacos ,都是在 nacos 操作的。
from pig.
给 nacos 指定一个 namespace,从环境变量中去读取,就可以实现一份代码多端部署了吧。配置都放到了 nacos ,都是在 nacos 操作的。
理想状态下,所有“打包产物中的配置”,都可以使用环境变量进行修改
from pig.
Related Issues (20)
- 创建了一个新租户,怎么给这个租户创建登录账号呢 HOT 1
- 代码生成中没有App.java
- 本地运行跑不起来,本人比较菜,麻烦帮我看下.. 谢谢了~ HOT 2
- pig后台管理页面的菜单导航宽度无法调整吗?
- 有考虑基于spring cloud Tencent实现吗? HOT 1
- token 传递过期怎么处理?
- docker maven 构建问题 HOT 1
- 如何迁移替换云原生网关? HOT 1
- 频繁调用接口登录,用户登录失败写日志导致的biz服务挂掉
- sentinel dashboard模块是被移除了吗? HOT 1
- nacos支持postgresql数据库 HOT 1
- logback配置中屏蔽nacos心跳的配置是否可以去除 HOT 1
- 本地host读取问题 HOT 1
- Dependency Dashboard
- Spring Boot Actuator敏感信息泄露 HOT 3
- BUG:RedisUtils. del(String... keys)传参有误 HOT 1
- 资源服务器如何去找认证服务器验证token是否合法的? HOT 1
- gateway关于验证码处理逻辑移出了? HOT 1
- 关于pig-common-log的问题
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pig.