Generate a config file from env vars and template

This commit is contained in:
Christopher Hoskin
2021-04-30 15:49:37 +01:00
parent 927d401111
commit f1c9d6108e
4 changed files with 45 additions and 3 deletions
+2
View File
@@ -1,4 +1,6 @@
*
!start.sh
!/conf
!/lib
!/src/main
!/pom.xml
+8 -3
View File
@@ -21,14 +21,19 @@ RUN make package \
FROM openjdk:8-jre
RUN apt-get update && apt-get install -y git \
RUN apt-get update && apt-get install -y git gettext-base\
&& rm -rf /var/lib/apt/lists
RUN useradd --create-home node
ENTRYPOINT ["java", "-jar", "/git-bridge.jar"]
CMD ["/conf/runtime.json"]
CMD ["/start.sh"]
COPY --from=builder /git-bridge.jar /
COPY conf/envsubst_template.json envsubst_template.json
COPY start.sh start.sh
RUN mkdir conf
RUN chown node:node conf
USER node
@@ -0,0 +1,32 @@
{
"port": 8080,
"rootGitDirectory": "/tmp/wlgb",
"apiBaseUrl": "https://localhost/api/v0",
"username": "$GITBRIDGE_USERNAME",
"password": "$GITBRIDGE_PASSWORD",
"postbackBaseUrl": "https://localhost",
"serviceName": "Overleaf",
"oauth2": {
"oauth2ClientID": "$GITBRIDGE_OAUTH2_CLIENT_ID",
"oauth2ClientSecret": "$GITBRIDGE_OAUTH2_CLIENT_SECRET",
"oauth2Server": "https://localhost"
},
"repoStore": {
"maxFileNum": 2000,
"maxFileSize": 52428800
},
"swapStore": {
"type": "s3",
"awsAccessKey": "asdf",
"awsSecret": "asdf",
"s3BucketName": "com.overleaf.testbucket",
"awsRegion": "us-east-1"
},
"swapJob": {
"minProjects": 50,
"lowGiB": 128,
"highGiB": 256,
"intervalMillis": 3600000,
"compressionMethod": "gzip"
}
}
+3
View File
@@ -0,0 +1,3 @@
#!/bin/bash
envsubst < /envsubst_template.json > /conf/runtime.json
java -jar /git-bridge.jar /conf/runtime.json