IDEA配置占位符,实现勾选改变环境
父工程pom.xml
<!-- 占位符的配置 -->
<profiles>
<!-- 开发环境 -->
<profile>
<id>dev</id>
<properties>
<myprofile>dev</myprofile>
<nacos-server>192.168.48.130:8848</nacos-server>
</properties>
</profile>
<!-- 测试环境 -->
<profile>
<id>test</id>
<properties>
<myprofile>test</myprofile>
<nacos-server>192.168.48.135:8846</nacos-server>
</properties>
</profile>
<!-- 生产环境环境 -->
<profile>
<id>prod</id>
<properties>
<myprofile>prod</myprofile>
<nacos-server>192.168.48.135:8845</nacos-server>
</properties>
</profile>
</profiles>
<build>
<!-- 配置占位符在配置文件中生效 -->
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
application.yml配置
server:
port: 80
spring:
application:
name: gateway
profiles:
#当前的环境
active: '@myprofile@'
cloud:
gateway:
routes:
- id: auth
uri: lb://ken-ability-auth
predicates:
- Path=/auth/**
filters:
- StripPrefix=1
- id: hotel
uri: lb://ken-business-hotel
predicates:
- Path=/hotel/**
filters:
- StripPrefix=1
#配置需要认证忽略的url
auth:
ignore:
urls:
- /hotel/file/**
- /hotel/city/open/api/**
- /auth/oauth/token
- /auth/open/api/**
版权声明:本文为qq_44982110原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。