I am trying develop a cookbook to make a flask app work with gunicorn and nginx. I have been successful to the point that the app is running very well with a local sqlite database, see my cookbook at https://github.com/harrywang/flasky-cookbook. The flask app uses environment variables for sending emails such as: MAIL_USERNAME = os.environ.get('MAIL_USERNAME'), how I can pass those environment variables to the ubuntu virtual machines using test kitchen during kitchen converge?
You can use Erb formatting in your .kitchen.yml
:
provisioner:
name: chef-solo
attributes:
mycookbook:
mail_username: <%= ENV['MAIL_USERNAME'] %>
And then use node['mycookbook']['mail_username']
in your recipe to pass the value to the application.