[英]Is it possible for an environment variable to hold an array value in cloud foundry manifest?
I am trying to push an app into cloud foundry, and pass an array value via environment variable.我正在尝试将应用程序推送到 Cloud Foundry,并通过环境变量传递一个数组值。 But I receive yaml: unmarshal errors: line 7: cannot unmarshal !!seq into string FAILED但我收到yaml: unmarshal errors: line 7: cannot unmarshal !!seq into string FAILED
manifest.yml:清单.yml:
---
applications:
- name: my-app1 # A default name for Cloud Foundry to give your app
memory: 128M # The amount of RAM required for each instance
disk_quota: 256M # How much disk space the application needs
no-route: true
health-check-type: none
buildpacks:
- https://github.com/cloudfoundry/nodejs-buildpack
env:
countries:
- america
- australia
- japan
- nertherland
please Note: I validated my yaml via online validators and it looks good.请注意:我通过在线验证器验证了我的 yaml,它看起来不错。
Environment variables are an operating system concept and are passed into your application.环境变量是一个操作系统概念,并被传递到您的应用程序中。 They must be strings.它们必须是字符串。
You can encode arbitrary JSON, YAML or binary data with base64 encoding as your env var value.您可以使用 base64 编码将任意 JSON、YAML 或二进制数据编码为您的环境变量值。
Inside your app, you would decode the base64 into your original string (say JSON string) and the parse it into the data structure you want (an array of strings in your case)在您的应用程序中,您将 base64 解码为原始字符串(例如 JSON 字符串)并将其解析为您想要的数据结构(在您的情况下为字符串数组)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.