php - How can I pull opsworks variables into a .env file with chef? -


i new chef , on last piece of puzzle. trying create .env file in project root using variables set in aws opsworks. can't life of me figure out.

does have suggestions or working chef recipe this? i've googled wits end.

you don't use .env file if you're using aws*. .env file mimics environment variables set @ operating system level, useful when you're developing locally or you're on hosting platform doesn't allow set these yourself.

so, need set environment variables app in opsworks , you're done. these loaded operating system php , available laravel application.

*the reason have sensitive data such database , api credentials stored in here. absolutely want keep these separate code , out of source control.

edit:

you can write .env file during deployment bit if need. chef script like:

node[:deploy].each |application, deploy|   # write out .env file   template "#{deploy[:deploy_to]}/current/.env"     source 'env.erb'     mode '0660'     owner deploy[:user]     group deploy[:group]     variables(       :env => deploy[:environment_variables]     )   end end 

this .env file template like:

<% @env.each |key, value| %> <%= key %>=<%= value %> <% end %> 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -