🔨 Move secret to init script

This commit is contained in:
Timmo 2019-03-30 11:31:16 +00:00
parent 162914b052
commit b78ed7750a
3 changed files with 7 additions and 41 deletions

View file

@ -10,7 +10,6 @@ COPY rootfs /
RUN \
apk add --no-cache --virtual .build-dependencies \
git=2.20.1-r0 \
openssl=1.1.1b-r1 \
yarn=1.12.3-r0 \
\
&& apk add --no-cache \
@ -26,9 +25,6 @@ RUN \
"https://github.com/timmo001/home-panel.git" /tmp/panel \
&& mv /tmp/panel/api /opt/api \
\
&& mv /etc/home-panel/default.json /opt/api/config \
&& sed -i "s/API_AUTH_SECRET/$(openssl rand -base64 32)/g" /opt/api/config/default.json \
\
&& cd /opt/api \
&& yarn install \
\

View file

@ -0,0 +1,7 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Community Hass.io Add-ons: Home Panel
# This updates the internal auth secret for the API
# ==============================================================================
# shellcheck disable=2094,2016
bashio::jq /opt/api/config/default.json '.authentication.secret="$(openssl rand -base64 32)"' > /opt/api/config/default.json

View file

@ -1,37 +0,0 @@
{
"host": "localhost",
"port": 3234,
"public": "../public/",
"paginate": {
"default": 10,
"max": 50
},
"authentication": {
"secret": "API_AUTH_SECRET",
"strategies": ["jwt", "local"],
"path": "/authentication",
"service": "users",
"jwt": {
"header": {
"typ": "access"
},
"audience": "https://timmo.dev/home-panel",
"subject": "anonymous",
"issuer": "feathers",
"algorithm": "HS256",
"expiresIn": "1d"
},
"local": {
"entity": "user",
"usernameField": "username",
"passwordField": "password"
},
"cookie": {
"enabled": true,
"name": "feathers-jwt",
"httpOnly": false,
"secure": false
}
},
"nedb": "/data"
}