在Cloud-Foundry中,我已经将mongo-secrets存储在CUPS中,我希望在mac中复制相同的内容。
这两个属性
vcap.services.mongo-creds.credentials.username=**
vcap.services.mongo-creds.credentials.password=**在用./gradlew bootRun在本地系统中运行我的应用程序之前,我给出了以下两个命令来设置这些属性,以便应用程序启动
export vcap.services.mongo-creds.credentials.username=**
export vcap.services.mongo-creds.credentials.password=**我在本地航站楼得到以下异常
arun$ export vcap.services.mongo-creds.credentials.username=***
-bash: export: `vcap.services.mongo-creds.credentials.username=**': not a valid identifier
arun$ 发布于 2019-10-04 15:10:33
我通过两次纠正就能做到
mongo-creds改为mongoCreds。连字符在我的Mac终端中不被接受dot或.替换为underscore或_export vcap_services_mongoCreds_credentials_username=***
应用程序能够获取这些变量。
发布于 2019-10-07 21:22:45
Bash不允许点.或破折号-作为变量标识符的一部分。
因此,在export表达式中,当为变量vcap.services.mongo-creds.credentials.username定义值时,Bash告诉您该变量的名称无效。
一个简单的解决方案是选择另一个变量名,或者使用下划线_代替。
但是,为了在Mac上拥有相关的cf push开发经验,我建议您使用CF本地,而不是基于普通的Gradle命令构建自己的临时设置。使用Cloud,您将能够从远程云创建基金会继承服务绑定,包括用cf cups创建的用户提供的服务。这应该适合您的用例相当好!
https://stackoverflow.com/questions/58238817
复制相似问题