elektrine/scripts/lib/render_docker_compose.awk
maxfield 645f1f54ef
Some checks failed
Deploy Docker Images / Build, push, and deploy (push) Failing after 20m16s
refactor: extract oversized modules and split runtime config
Keep product modules under maintainability budgets by moving LiveView
and domain helpers into focused files. Split config/runtime.exs so
secrets, roles, and feature flags are not mixed in one file, and add
schema dump/load plus per-role boot smokes so a slim-module release
can be proven locally.

Also route conversations by table ownership, hide empty activity
counts, and fail-close CI now that mix test is green.
2026-08-22 02:24:30 -04:00

99 lines
2.1 KiB
Awk

function profile_selected(profile) {
return index(" " selected_profiles " ", " " profile " ") > 0
}
function process_line(line, inline_profile) {
if (line ~ /^[[:space:]]*profiles:[[:space:]]*\[[^]]+\]/) {
inline_profile = line
sub(/^.*\["/, "", inline_profile)
sub(/"\].*$/, "", inline_profile)
if (profile_selected(inline_profile)) {
return
}
}
print line
}
pending_profiles_line != "" {
profile_line = $0
profile_name = profile_line
sub(/^[[:space:]]*-[[:space:]]*/, "", profile_name)
sub(/[[:space:]]*$/, "", profile_name)
if (profile_line ~ /^[[:space:]]*-[[:space:]]*[A-Za-z0-9_-]+[[:space:]]*$/ && profile_selected(profile_name)) {
pending_profiles_line = ""
next
}
print pending_profiles_line
pending_profiles_line = ""
process_line($0)
next
}
/^[[:space:]]*profiles:[[:space:]]*$/ {
pending_profiles_line = $0
next
}
/\$\{ELEKTRINE_IMAGE:-[^}]*\}/ {
if (ENVIRON["ELEKTRINE_IMAGE"] != "") {
sub(/\$\{ELEKTRINE_IMAGE:-[^}]*\}/, ENVIRON["ELEKTRINE_IMAGE"])
}
process_line($0)
next
}
/ELEKTRINE_RELEASE_MODULES:/ {
sub(/\$\{ELEKTRINE_RELEASE_MODULES:-[^}]*\}/, "${ELEKTRINE_RELEASE_MODULES:-" release_modules "}")
process_line($0)
next
}
/INSTALL_TOR:/ {
sub(/\$\{INSTALL_TOR:-[^}]*\}/, "${INSTALL_TOR:-" install_tor "}")
process_line($0)
next
}
/INSTALL_VPN_TOOLS:/ {
sub(/\$\{INSTALL_VPN_TOOLS:-[^}]*\}/, "${INSTALL_VPN_TOOLS:-" install_vpn_tools "}")
process_line($0)
next
}
/ELEKTRINE_ENABLED_MODULES:/ {
sub(/\$\{ELEKTRINE_ENABLED_MODULES:-[^}]*\}/, "${ELEKTRINE_ENABLED_MODULES:-" enabled_modules "}")
process_line($0)
next
}
/ELEKTRINE_ENABLE_TOR:/ {
sub(/\$\{ELEKTRINE_ENABLE_TOR:-[^}]*\}/, "${ELEKTRINE_ENABLE_TOR:-" tor_enabled "}")
process_line($0)
next
}
/TURN_ENABLED:/ {
sub(/\$\{TURN_ENABLED:-[^}]*\}/, "${TURN_ENABLED:-" turn_enabled "}")
process_line($0)
next
}
/\/etc\/caddy\/Caddyfile:ro/ {
sub(/\$\{CADDY_CONFIG_PATH:-[^}]*\}/, "${CADDY_CONFIG_PATH:-" caddy_config_default "}")
process_line($0)
next
}
{
process_line($0)
}
END {
if (pending_profiles_line != "") {
print pending_profiles_line
}
}