英文:
How to add in AWS env variable which is not a simple string ( contains nested brackets and such )?
问题
我想在我的 AWS 环境中添加这个环境变量。
GCP_CREDENTIALS={
"type": "service_account",
"project_id": "dummy-project-id",
"private_key_id": "dummy-private-key-id",
"private_key": "-----BEGIN PRIVATE KEY-----\ndummyPrivateKey\n-----END PRIVATE KEY-----\n",
"client_email": "dummy-client-email@dummy-project-id.iam.gserviceaccount.com",
"client_id": "dummy-client-id",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/dummy-client-email%40dummy-project-id.iam.gserviceaccount.com"
}
英文:
I would like to add this environment variable in my aws env.
GCP_CREDENTIALS={
"type": "service_account",
"project_id": "dummy-project-id",
"private_key_id": "dummy-private-key-id",
"private_key": "-----BEGIN PRIVATE KEY-----\ndummyPrivateKey\n-----END PRIVATE KEY-----\n",
"client_email": "dummy-client-email@dummy-project-id.iam.gserviceaccount.com",
"client_id": "dummy-client-id",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/dummy-client- email%40dummy-project-id.iam.gserviceaccount.com"
}
How do I do it?
Simply pasting does not work. I think they are expecting a simple string without any brackets.
答案1
得分: 5
将字符串,包括大括号,编码为base64字符串。然后解码并在文件中的任何位置使用它。这样,括号将被移除,AWS 将识别它为合法的环境变量。
英文:
First, encode the string, including the curly braces, into a base64 string. Then decode and use it wherever you want to in your file. This way, the brackets will be removed, and AWS will identify it as a legit environment variable.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论