Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
louisroyer committed Oct 23, 2024
1 parent 48c0cad commit 6eaf4d9
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 2 deletions.
2 changes: 1 addition & 1 deletion srv6-ctrl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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}


Expand Down
27 changes: 27 additions & 0 deletions srv6-ctrl/template-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
4 changes: 4 additions & 0 deletions srv6-ctrl/template-srv6-ctrl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ http-address: "%HTTP_ADDRESS"
http-port: "%HTTP_PORT"
logger:
level: "%LOG_LEVEL"
downlink:
%DOWNLINK
uplink:
%UPLINK
2 changes: 1 addition & 1 deletion srv6/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \;

Expand Down

0 comments on commit 6eaf4d9

Please sign in to comment.