mirror of
https://github.com/optim-enterprises-bv/databunker.git
synced 2025-10-30 01:22:28 +00:00
passing masterkey as environment variable
This commit is contained in:
@@ -37,12 +37,14 @@ COPY --from=builder /bin/busybox /bin/busybox
|
||||
COPY --from=builder /bin/busybox /bin/sh
|
||||
COPY --from=builder /lib/ld* /lib/
|
||||
COPY --from=builder /go/bin/databunker /databunker/bin/databunker
|
||||
COPY run.sh /databunker/bin/run.sh
|
||||
COPY run.sh /databunker/bin/
|
||||
#COPY create-test-user.sh /databunker/bin/
|
||||
COPY databunker.yaml /databunker/conf/
|
||||
RUN /bin/busybox mkdir -p /databunker/data
|
||||
RUN /bin/busybox mkdir -p /databunker/certs
|
||||
#RUN /bin/busybox ln -s /bin/busybox /bin/sh
|
||||
# Run the hello binary.
|
||||
#ENTRYPOINT ["/go/bin/databunker"]
|
||||
EXPOSE 3000
|
||||
ENTRYPOINT ["/bin/sh", "/databunker/bin/run.sh"]
|
||||
#CMD ["/bin/sh", "-x", "-c", "/go/bin/databunker -init"]
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
DATABUNKER_APIKEY='689464cf-2485-b7e8-1c65-f2ce40ce507c'
|
||||
DATABUNKER_APIKEY=$1
|
||||
if [ -z $DATABUNKER_APIKEY ]; then
|
||||
echo "missing api key parameter"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "Creating user."
|
||||
RESULT=`curl -s http://localhost:3000/v1/user \
|
||||
|
||||
10
run.sh
10
run.sh
@@ -2,19 +2,21 @@
|
||||
|
||||
/bin/busybox find /databunker
|
||||
|
||||
DATABUNKER_MASTERKEY=""
|
||||
if [ ! -f /databunker/data/databunker.db ]; then
|
||||
echo "-------------INIT------------"
|
||||
/bin/busybox mkdir -p /tmp
|
||||
RESULT=`/databunker/bin/databunker -init -db /databunker/data/databunker.db -conf /databunker/conf/databunker.yaml > /tmp/init.txt`
|
||||
echo $RESULT
|
||||
ROOT_TOKEN=`/bin/busybox awk '/API Root token:/ {print $4}' /tmp/init.txt`
|
||||
DATABUNKER_ROOTTOKEN=`/bin/busybox awk '/API Root token:/ {print $4}' /tmp/init.txt`
|
||||
DATABUNKER_MASTERKEY=`/bin/busybox awk '/Master key:/ {print $3}' /tmp/init.txt`
|
||||
echo "DATABUNKER_ROOTTOKEN $ROOT_TOKEN"
|
||||
echo "DATABUNKER_ROOTTOKEN $DATABUNKER_ROOTTOKEN"
|
||||
echo "DATABUNKER_MASTERKEY $DATABUNKER_MASTERKEY"
|
||||
/bin/busybox rm -rf /tmp/init.txt
|
||||
fi
|
||||
#echo "-------------ENV-------------"
|
||||
#/bin/busybox env
|
||||
echo "-------------FIND------------"
|
||||
/bin/busybox find /databunker
|
||||
echo "-------------RUN-------------"
|
||||
/databunker/bin/databunker -masterkey $DATABUNKER_MASTERKEY -db /databunker/data/databunker.db -conf /databunker/conf/databunker.yaml
|
||||
/databunker/bin/databunker -masterkey $DATABUNKER_MASTERKEY \
|
||||
-db /databunker/data/databunker.db -conf /databunker/conf/databunker.yaml
|
||||
|
||||
@@ -252,6 +252,10 @@ func main() {
|
||||
os.Exit(0)
|
||||
}
|
||||
if masterKeyPtr != nil && len(*masterKeyPtr) > 0 {
|
||||
if len(*masterKeyPtr) != 48 {
|
||||
fmt.Printf("Failed to decode master key: bad length\n")
|
||||
os.Exit(0)
|
||||
}
|
||||
masterKey, err = hex.DecodeString(*masterKeyPtr)
|
||||
if err != nil {
|
||||
fmt.Printf("Failed to decode master key: %s\n", err)
|
||||
|
||||
Reference in New Issue
Block a user