Fix machinkey substitution in packages
This commit is contained in:
parent
8faf8d8a5c
commit
cf033509b3
@ -171,6 +171,13 @@ while [ "$1" != "" ]; do
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
|
||||
-mk | --machinekey )
|
||||
if [ "$2" != "" ]; then
|
||||
CORE_MACHINEKEY=$2
|
||||
shift
|
||||
fi
|
||||
;;
|
||||
|
||||
-? | -h | --help )
|
||||
echo " Usage: bash ${PRODUCT}-configuration [PARAMETER] [[PARAMETER], ...]"
|
||||
@ -192,6 +199,7 @@ while [ "$1" != "" ]; do
|
||||
echo " -mysqld, --mysqldatabase ${PRODUCT} database name"
|
||||
echo " -mysqlu, --mysqluser ${PRODUCT} database user"
|
||||
echo " -mysqlp, --mysqlpassword ${PRODUCT} database password"
|
||||
echo " -mk, --machinekey setting for core.machinekey"
|
||||
echo " -e, --environment environment (default 'production')"
|
||||
echo " -?, -h, --help this help"
|
||||
echo
|
||||
@ -207,12 +215,17 @@ while [ "$1" != "" ]; do
|
||||
done
|
||||
|
||||
set_core_machinekey () {
|
||||
if [ -f $APP_DIR/.private/machinekey ]; then
|
||||
CORE_MACHINEKEY=$(cat $APP_DIR/.private/machinekey)
|
||||
if [[ -f $APP_DIR/.private/machinekey ]] || [[ -n $CORE_MACHINEKEY ]]; then
|
||||
CORE_MACHINEKEY=${CORE_MACHINEKEY:-$(cat $APP_DIR/.private/machinekey)};
|
||||
else
|
||||
CORE_MACHINEKEY=$(cat /dev/urandom | tr -dc A-Za-z0-9 | head -c 12);
|
||||
echo $CORE_MACHINEKEY >> $APP_DIR/.private/machinekey
|
||||
chmod o-rwx $APP_DIR/.private/machinekey
|
||||
if [ "$DIST" = "RedHat" ]; then
|
||||
echo $CORE_MACHINEKEY >> $APP_DIR/.private/machinekey
|
||||
chmod o-rwx $APP_DIR/.private/machinekey
|
||||
elif [ "$DIST" = "Debian" ]; then
|
||||
db_set ${PRODUCT}/machinekey $CORE_MACHINEKEY || true
|
||||
echo ${PRODUCT} ${PRODUCT}/machinekey select $CORE_MACHINEKEY | debconf-set-selections || true
|
||||
fi
|
||||
fi
|
||||
|
||||
$JSON_USERCONF "this.core={'base-domain': \"$APP_HOST\", 'machinekey': \"$CORE_MACHINEKEY\" }" >/dev/null 2>&1
|
||||
|
@ -12,8 +12,10 @@ case "$1" in
|
||||
APP_HOST="$RET"
|
||||
db_get {{product}}/port || true
|
||||
APP_PORT="$RET"
|
||||
db_get {{product}}/machinekey || true
|
||||
CORE_MACHINEKEY="$RET"
|
||||
|
||||
args+=(-e "$ENVIRONMENT" -ash "$APP_HOST" -asp "$APP_PORT" );
|
||||
args+=(-e "$ENVIRONMENT" -ash "$APP_HOST" -asp "$APP_PORT" -mk "$CORE_MACHINEKEY" );
|
||||
|
||||
db_get {{product}}/db-host || true
|
||||
DB_HOST="$RET"
|
||||
@ -25,7 +27,7 @@ case "$1" in
|
||||
DB_PWD="$RET"
|
||||
|
||||
args+=(-mysqlh "$DB_HOST" -mysqld "$DB_NAME" -mysqlu "$DB_USER" );
|
||||
[ -n "$DB_PWD" ] && args+=(-mysqlp "$DB_PWD" );
|
||||
[ -n "$DB_PWD" ] && args+=(-mysqlp "$DB_PWD" );
|
||||
|
||||
db_get {{product}}/redis-host || true
|
||||
REDIS_HOST="$RET"
|
||||
|
@ -77,3 +77,7 @@ Template: {{product}}/rabbitmq-password
|
||||
Type: string
|
||||
Default: guest
|
||||
Description: RabbitMQ password:
|
||||
|
||||
Template: {{product}}/machinekey
|
||||
Type: string
|
||||
Description: Enter your own machinekey:
|
||||
|
Loading…
Reference in New Issue
Block a user