47 lines
1.0 KiB
Jsonnet
47 lines
1.0 KiB
Jsonnet
# Tag to add a restart policy on all containers
|
|
#
|
|
# Examples:
|
|
# tags:
|
|
# - docker-svc-tz:
|
|
# policy: always
|
|
# services:
|
|
# - srv1
|
|
# - mysqldb
|
|
|
|
# Default imports
|
|
local user_data = std.parseJson(std.extVar('user_data'));
|
|
local docker_data = std.parseJson(std.extVar('docker_data'));
|
|
|
|
# Init defaults
|
|
local default_svcs = std.get(user_data, 'PAASIFY_STACK_SVCS');
|
|
#local default_tz = 'UTC';
|
|
#local default_tz = 'Europe/Paris';
|
|
local default_tz = 'America/Toronto';
|
|
local default_mount = false;
|
|
local default_mounts = '/etc/timezone:/etc/timezone:ro,/etc/localtime:/etc/localtime:ro';
|
|
|
|
# Build default config
|
|
local config_default = {
|
|
APP_SERVICES: default_svcs,
|
|
APP_TZ: default_tz,
|
|
APP_TZ_MOUNT: default_mount,
|
|
APP_TZ_MOUNTS: default_mounts,
|
|
};
|
|
|
|
local conf = config_default + user_data;
|
|
local services_names = std.split(conf.APP_SERVICES, ',') ;
|
|
|
|
# Process
|
|
docker_data +
|
|
{
|
|
services+: {
|
|
[svc_name]+: {
|
|
environment+: {
|
|
TZ: conf.APP_TZ
|
|
}
|
|
} for svc_name in services_names
|
|
},
|
|
}
|
|
|
|
|