How to set multiline RSA private key environment variable for AWS Elastic Beans

后端 未结 3 749
萌比男神i
萌比男神i 2021-01-17 12:31

I am deploying a Ruby on Rails application to AWS using Elastic Beanstalk and have to set a private key as an environment variable

E.g

-----BEGIN RSA

3条回答
  •  心在旅途
    2021-01-17 12:40

    You could set it in EB using \n and then convert the '\n' to newlines before you pass it to config.key - something like this (note the single and double quotes in the call to gsub):

    single_line_key = ENV.fetch('CLOUDFRONT_KEY')
    multi_line_key = single_line_key.gsub('\n', "\n")
    config.key = multi_line_key
    

提交回复
热议问题