environment-variables - 如何使用嵌套列表作为环境变量
问题描述
我有这个yml
文件:
spring:
cloud:
gateway:
routes:
- id: microservice1
uri: http://m1:8082
predicates:
- Path=/m1/**
- Method=GET,POST,DELETE,PUT,OPTIONS
- id: microservice2
uri: http://m2:8083
predicates:
- Path=/m2/**
- Method=GET,POST,DELETE,PUT,OPTIONS
我想翻译成一个.env
文件。
我怎么能得到那个?,我已经试过了(我添加了新的行以更容易阅读,在我的本地都是一行):
spring.cloud.gateway.routes=[
id=microservice1,
uri=http://m1:8082,
predicates=[
Path=/m1/**,
Method=GET,POST,DELETE,PUT,OPTIONS]
],
id=microservice2,
uri=http://m2:8083,
predicates=[
Path=/m2/**,
Method=GET,POST,DELETE,PUT,OPTIONS]
],
但它会引发错误:
Illegal character in path at index 0: [Path=/m1/**
解决方案
推荐阅读
- javascript - 在 React Native 中制作购物车页面的最佳方法是什么?
- django - 使用 nginx/uwsgi 时间歇性没有名为 context_processors 的模块
- c# - 如何在 NUnit 中测试多个相同类型的对象
- javascript - 在浏览器窗口中自动转换日期
- mysql - mysql 在更改表修改列期间出现错误 1062
- spring-boot - 使用 cxf-spring-boot-starter-jaxws 公开 SOAP 端点
- qt - 无论操作系统如何,如何在 Qt Installer 框架中创建环境变量
- python - 在 PyCharm 中,如何在导入的 Cython 扩展代码中换行
- c++ - 如何在类中使用重载的 const_iterator?
- c - 将字符串中的数字乘以 2