From b49dfa915efe4d194f265d13d5d98baa3acda042 Mon Sep 17 00:00:00 2001 From: William Mantly Date: Wed, 15 May 2019 01:45:34 -0400 Subject: [PATCH] attributes --- Vagrantfile | 5 +++++ cookbooks/hosting/recipes/postgress.rb | 4 +--- cookbooks/hosting/templates/app.ini.erb | 10 +++++----- cookbooks/hosting/templates/host.conf.erb | 2 +- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 7f0c6c5..bf93760 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -45,5 +45,10 @@ Vagrant.configure("2") do |config| chef.cookbooks_path = "cookbooks/" chef.roles_path = "roles" chef.add_role("gitea") + chef.json = { + 'custom-domain': 'localhost.vm42.us', + 'custom-title': 'My gitea server!', + 'db-password': 'mypassword', + } end end diff --git a/cookbooks/hosting/recipes/postgress.rb b/cookbooks/hosting/recipes/postgress.rb index 070b751..37ed252 100644 --- a/cookbooks/hosting/recipes/postgress.rb +++ b/cookbooks/hosting/recipes/postgress.rb @@ -1,5 +1,3 @@ -target_locale = 'en_US.UTF-8' - postgresql_server_install 'My PostgreSQL Server install' do initdb_locale 'en_US.utf8' action :install @@ -20,7 +18,7 @@ postgresql_access 'local_postgres_superuser' do end postgresql_user 'gitea' do - password 'UserP4ssword' + password node['db-password'] # createrole true end diff --git a/cookbooks/hosting/templates/app.ini.erb b/cookbooks/hosting/templates/app.ini.erb index ffbb6de..dc7e60b 100644 --- a/cookbooks/hosting/templates/app.ini.erb +++ b/cookbooks/hosting/templates/app.ini.erb @@ -1,4 +1,4 @@ -APP_NAME = Gitea: Git with a cup of tea +APP_NAME = <%= node['custom-title'] %> RUN_USER = gitea RUN_MODE = prod @@ -15,7 +15,7 @@ DB_TYPE = postgres HOST = 127.0.0.1:5432 NAME = gitea USER = gitea -PASSWD = UserP4ssword +PASSWD = <%= node['db-password'] %> SSL_MODE = disable PATH = /opt/theta42/data/gitea.db @@ -23,10 +23,10 @@ PATH = /opt/theta42/data/gitea.db ROOT = /root/gitea-repositories [server] -SSH_DOMAIN = localhost -DOMAIN = localhost +SSH_DOMAIN = <%= node['custom-domain'] %> +DOMAIN = <%= node['custom-domain'] %> HTTP_PORT = 3000 -ROOT_URL = http://localhost:3000/ +ROOT_URL = http://<%= node['custom-domain'] %>/ DISABLE_SSH = false SSH_PORT = 22 LFS_START_SERVER = true diff --git a/cookbooks/hosting/templates/host.conf.erb b/cookbooks/hosting/templates/host.conf.erb index 0cc05b4..3185209 100644 --- a/cookbooks/hosting/templates/host.conf.erb +++ b/cookbooks/hosting/templates/host.conf.erb @@ -1,7 +1,7 @@ server { listen 80; listen 443 ssl; - server_name localhost.vm42.us; + server_name <%= node['custom-domain']; include autossl.conf;