Compare commits

...

3 Commits

Author SHA1 Message Date
5a83bb80b1 v0.0.5 2018-11-07 11:25:26 +01:00
8c68f2c01d Merge pull request #15 from balena-io/pass-superuser-creds-in-env
env: Pass superuser credentials in the environment
2018-11-07 10:23:39 +00:00
55f60c60d2 env: Pass superuser credentials in the environment
Allows the credentials to be passed via the environment in order
that the application can create the user on start up.

Change-type: patch
Signed-off-by: Rich Bayliss <rich@balena.io>
2018-11-07 10:10:26 +00:00
5 changed files with 25 additions and 6 deletions

View File

@ -1,6 +1,12 @@
# Change Log
All notable changes to this project will be documented in this file
# v0.0.5
## (2018-11-07)
* env: Pass superuser credentials in the environment [Rich Bayliss]
automatically by Versionist. DO NOT EDIT THIS FILE MANUALLY!
This project adheres to [Semantic Versioning](http://semver.org/).

View File

@ -1 +1 @@
0.0.4
0.0.5

View File

@ -53,6 +53,8 @@ services:
VPN_HOST: vpn.${OPENBALENA_HOST_NAME}
VPN_PORT: 443
VPN_SERVICE_API_KEY: ${OPENBALENA_VPN_SERVICE_API_KEY}
SUPERUSER_EMAIL: ${OPENBALENA_SUPERUSER_EMAIL}
SUPERUSER_PASSWORD: ${OPENBALENA_SUPERUSER_PASSWORD}
registry:
extends:

View File

@ -19,7 +19,7 @@ usage() {
echo
}
for var in DOMAIN ROOT_CA ROOT_CRT ROOT_KEY JWT_CRT JWT_KEY JWT_KID VPN_CA VPN_CRT VPN_KEY VPN_DH; do
for var in DOMAIN ROOT_CA ROOT_CRT ROOT_KEY JWT_CRT JWT_KEY JWT_KID VPN_CA VPN_CRT VPN_KEY VPN_DH SUPERUSER_EMAIL SUPERUSER_PASSWORD; do
if [ -z "${!var-}" ]; then
usage
exit 1
@ -85,4 +85,6 @@ export OPENBALENA_API_VPN_SERVICE_API_KEY=$(randstr 32)
export OPENBALENA_REGISTRY_SECRET_KEY=$(randstr 32)
export OPENBALENA_SSH_AUTHORIZED_KEYS=
export NODE_EXTRA_CA_CERTS="$ROOT_CA"
export OPENBALENA_SUPERUSER_EMAIL=$SUPERUSER_EMAIL
export OPENBALENA_SUPERUSER_PASSWORD=$SUPERUSER_PASSWORD
STR

View File

@ -9,20 +9,24 @@ CERTS_DIR="${CONFIG_DIR}/certs"
DOMAIN=openbalena.local
usage() {
echo "usage: $0 [-h] [-p] [-d DOMAIN]"
echo "usage: $0 [-h] [-p] [-d DOMAIN] -U EMAIL -P PASSWORD"
echo
echo " -p patch hosts - patch the host /etc/hosts file"
echo " -d DOMAIN the domain name this deployment will run as, eg. example.com. Default is 'openbalena.local'"
echo " -p patch hosts - patch the host /etc/hosts file"
echo " -d DOMAIN the domain name this deployment will run as, eg. example.com. Default is 'openbalena.local'"
echo " -U EMAIL the email address of the superuser account, used to login to your install from the Balena CLI"
echo " -P PASSWORD the password to use for the superuser account."
echo
}
show_help=false
patch_hosts=false
while getopts ":hpd:" opt; do
while getopts ":hpd:U:P:" opt; do
case "${opt}" in
h) show_help=true;;
p) patch_hosts=true;;
d) DOMAIN="${OPTARG}";;
U) SUPERUSER_EMAIL="${OPTARG}";;
P) SUPERUSER_PASSWORD="${OPTARG}";;
*)
echo "Invalid argument: -${OPTARG}"
usage
@ -32,6 +36,11 @@ while getopts ":hpd:" opt; do
done
shift $((OPTIND-1))
if [ -z "${SUPERUSER_EMAIL}" ] || [ -z "${SUPERUSER_PASSWORD}" ]; then
usage
exit 1
fi
if [ "$show_help" = "true" ]; then
usage
exit 1