Advertisement
Guest User

Untitled

a guest
Mar 16th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. require 'yaml'
  2.  
  3. Vagrant.configure(2) do |config|
  4. config.vm.box = "ubuntu/trusty64"
  5. config.vm.network "forwarded_port", guest: 80, host: 8080
  6.  
  7. # Parse secrets from Rails' config file (ignored in the repo)
  8. secrets_file = File.expand_path(File.join(File.dirname(__FILE__), 'config', 'secrets.yml'))
  9. secrets = YAML::load_file secrets_file
  10.  
  11. database = secrets['production']['database']['database']
  12. username = secrets['production']['database']['username']
  13. password = secrets['production']['database']['password']
  14.  
  15. # The provisioning script receives the environment variables in the env hash.
  16. # This allows us to keep things secret and use a single source of truth instead of
  17. # having databags and similar around many places. Single Source of Truth.
  18. config.vm.provision "shell", path: './config/deploy/server_provisioning.sh', env: {
  19. PRODUCTION_DATABASE_DATABASE: database,
  20. PRODUCTION_DATABASE_USERNAME: username,
  21. PRODUCTION_DATABASE_PASSWORD: password,
  22. NGINX_HOSTNAME: 'my.hostname.com'
  23. }
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement