diff --git a/srv6-ctrl/Dockerfile b/srv6-ctrl/Dockerfile index 8cbe882..cfe0161 100644 --- a/srv6-ctrl/Dockerfile +++ b/srv6-ctrl/Dockerfile @@ -4,7 +4,7 @@ # SPDX-License-Identifier: MIT FROM golang:1.22 AS builder -ARG COMMIT=v0.0.15 +ARG COMMIT=v0.0.16 RUN : ${COMMIT:? Missing build-arg COMMIT.} && go install github.com/nextmn/srv6-ctrl@${COMMIT} diff --git a/srv6-ctrl/template-script.sh b/srv6-ctrl/template-script.sh index b7b7771..0fe734e 100755 --- a/srv6-ctrl/template-script.sh +++ b/srv6-ctrl/template-script.sh @@ -15,17 +15,44 @@ if [ -z "$HTTP_ADDRESS" ]; then echo "Missing mandatory environment variable (HTTP_ADDRESS)." > /dev/stderr exit 1 fi +if [ -z "$UPLINK" ]; then + echo "Missing mandatory environment variable (UPLINK)." > /dev/stderr + exit 1 +fi +if [ -z "$DOWNLINK" ]; then + echo "Missing mandatory environment variable (DOWNLINK)." > /dev/stderr + exit 1 +fi + +IFS=$'\n' +DOWNLINK_SUB="" +for D in ${DOWNLINK}; do + if [ -n "${D}" ]; then + DOWNLINK_SUB="${DOWNLINK_SUB}\n ${D}" + fi +done + +UPLINK_SUB="" +for U in ${UPLINK}; do + if [ -n "${U}" ]; then + UPLINK_SUB="${UPLINK_SUB}\n ${U}" + fi +done awk \ -v LOG_LEVEL="${LOG_LEVEL:-info}" \ -v N4="${N4}" \ -v HTTP_ADDRESS="${HTTP_ADDRESS}" \ -v HTTP_PORT="${HTTP_PORT:-80}" \ + -v UPLINK="${UPLINK_SUB}" \ + -v DOWNLINK="${DOWNLINK_SUB}" \ '{ sub(/%LOG_LEVEL/, LOG_LEVEL); sub(/%HTTP_ADDRESS/, HTTP_ADDRESS); sub(/%HTTP_PORT/, HTTP_PORT); sub(/%N4/, N4); + sub(/%UPLINK/, UPLINK); + sub(/%DOWNLINK/, DOWNLINK); print; }' \ "${CONFIG_TEMPLATE}" > "${CONFIG_FILE}" diff --git a/srv6-ctrl/template-srv6-ctrl.yaml b/srv6-ctrl/template-srv6-ctrl.yaml index 9cc369b..29eccab 100644 --- a/srv6-ctrl/template-srv6-ctrl.yaml +++ b/srv6-ctrl/template-srv6-ctrl.yaml @@ -3,3 +3,7 @@ http-address: "%HTTP_ADDRESS" http-port: "%HTTP_PORT" logger: level: "%LOG_LEVEL" +downlink: + %DOWNLINK +uplink: + %UPLINK diff --git a/srv6/Dockerfile b/srv6/Dockerfile index 325f915..d9a7511 100644 --- a/srv6/Dockerfile +++ b/srv6/Dockerfile @@ -4,7 +4,7 @@ # SPDX-License-Identifier: MIT FROM golang:1.22 AS builder -ARG COMMIT=v0.0.19 +ARG COMMIT=v0.0.20 RUN : ${COMMIT:? Missing build-arg COMMIT.} && go install github.com/nextmn/srv6@${COMMIT} \ && find /go/pkg/mod/github.com/nextmn -iname 'srv6@*' -type d -exec ln -s {} /configuration \;