gen-config: 'service' replaces several variables.

master
Luka Vandervelden 2019-10-28 06:17:45 +01:00
parent 0f89791a76
commit 86f3294689
4 changed files with 14 additions and 19 deletions

View File

@ -94,12 +94,7 @@ class GenConfig::Context
if service = Service.get_by_id service_id if service = Service.get_by_id service_id
environment = service.environment environment = service.environment
options["id"] = service.full_id options["service"] = service.to_genconfig
options["name"] = service.name
options["service_root"] = service.root
options["environment"] = environment.name
options["environment_root"] = environment.root
providers = Hash(String, Variables).new providers = Hash(String, Variables).new
service.providers.each do |token, provider| service.providers.each do |token, provider|

View File

@ -16,25 +16,25 @@ SECRET_KEY = vPFgSqRMIe7Dzk4frRM4UA3CETedL8agK7x6IQFQt9YfRPiQGhQbYAGfyan71iU
[database] [database]
DB_TYPE = postgres DB_TYPE = postgres
HOST = 127.0.0.1:{{ port(providers.postgresql) }} HOST = 127.0.0.1:{{ port(providers.postgresql) }}
NAME = {{ id | replace("/", "_") }}_db NAME = {{ service.id | replace("/", "_") }}_db
USER = {{ id | replace("/", "_") }} USER = {{ service.id | replace("/", "_") }}
PASSWD = {{ random_password( id ) }} PASSWD = {{ random_password( service.id ) }}
SSL_MODE = disable SSL_MODE = disable
CHARSET = utf8 CHARSET = utf8
PATH = /srv/{{ environment }}/gitea/data/gitea.db PATH = {{ service.root }}/data/gitea.db
[repository] [repository]
ROOT = /srv/{{ environment }}/gitea/repositories ROOT = {{ service.root }}/repositories
[server] [server]
SSH_DOMAIN = localhost SSH_DOMAIN = localhost
DOMAIN = localhost DOMAIN = localhost
HTTP_PORT = {{ port(id) }} HTTP_PORT = {{ port(service.id) }}
ROOT_URL = http://localhost:{{ port(id) }}/ ROOT_URL = http://localhost:{{ port(service.id) }}/
DISABLE_SSH = false DISABLE_SSH = false
SSH_PORT = 22 SSH_PORT = 22
LFS_START_SERVER = true LFS_START_SERVER = true
LFS_CONTENT_PATH = /srv/{{ environment }}/gitea/data/lfs LFS_CONTENT_PATH = {{ service.root }}/data/lfs
LFS_JWT_SECRET = nUIANTsStEelCeOo7SFTcJllpJ6I8DXNr7duUgGMXfI LFS_JWT_SECRET = nUIANTsStEelCeOo7SFTcJllpJ6I8DXNr7duUgGMXfI
OFFLINE_MODE = false OFFLINE_MODE = false
@ -67,6 +67,6 @@ PROVIDER = file
[log] [log]
MODE = file MODE = file
LEVEL = info LEVEL = info
ROOT_PATH = /srv/{{ environment }}/gitea/log ROOT_PATH = {{ service.root }}/log

View File

@ -8,8 +8,8 @@ events {
} }
http { http {
error_log /var/log/{{ id | replace("/", "_") }}_error.log warn; error_log /var/log/{{ service.id | replace("/", "_") }}_error.log warn;
access_log /var/log/{{ id | replace("/", "_") }}_access.log; access_log /var/log/{{ service.id | replace("/", "_") }}_access.log;
include /etc/nginx/mime.types; include /etc/nginx/mime.types;
default_type application/octet-stream; default_type application/octet-stream;

View File

@ -60,7 +60,7 @@
# comma-separated list of addresses; # comma-separated list of addresses;
# defaults to 'localhost'; use '*' for all # defaults to 'localhost'; use '*' for all
# (change requires restart) # (change requires restart)
port = {{port(id)}} port = {{port(service.id)}}
max_connections = 100 # (change requires restart) max_connections = 100 # (change requires restart)
#superuser_reserved_connections = 3 # (change requires restart) #superuser_reserved_connections = 3 # (change requires restart)
#unix_socket_directories = '/run/postgresql' # comma-separated list of directories #unix_socket_directories = '/run/postgresql' # comma-separated list of directories