Merge pull request #103 from keitaroinc/session-from-chart

Session secrets
This commit is contained in:
Filip.mihajlovski 2023-06-27 11:57:55 +02:00 committed by GitHub
commit 96e9c65640
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 32 additions and 0 deletions

View File

@ -170,6 +170,9 @@ RUN pip install -e /srv/app/src/ckan && \
# Remove wheels # Remove wheels
RUN rm -rf /srv/app/wheels /srv/app/ext_wheels RUN rm -rf /srv/app/wheels /srv/app/ext_wheels
# Install python2 secrets for generating sessions
RUN pip install python2-secrets
# Copy necessary scripts # Copy necessary scripts
COPY setup/app ${APP_DIR} COPY setup/app ${APP_DIR}

View File

@ -12,6 +12,14 @@ then
done done
fi fi
# Add session secret from chart
if [[ -z $BEAKER_SESSION_SECRET || -v $BEAKER_SESSION_SECRET ]];then
echo "Not all environment variables are set. Generating sessions..."
else
echo "Setting session secrets from environment variables"
paster --plugin=ckan config-tool $APP_DIR/production.ini "beaker.session.secret=$BEAKER_SESSION_SECRET"
fi
if grep -E "beaker.session.secret ?= ?$" $APP_DIR/production.ini if grep -E "beaker.session.secret ?= ?$" $APP_DIR/production.ini
then then
echo "Setting beaker.session.secret in ini file" echo "Setting beaker.session.secret in ini file"

View File

@ -163,6 +163,9 @@ RUN pip install -e /srv/app/src/ckan && \
# Remove wheels # Remove wheels
RUN rm -rf /srv/app/wheels /srv/app/ext_wheels RUN rm -rf /srv/app/wheels /srv/app/ext_wheels
# Install python2 secrets for generating sessions
RUN pip install python2-secrets
# Copy necessary scripts # Copy necessary scripts
COPY setup/app ${APP_DIR} COPY setup/app ${APP_DIR}

View File

@ -12,6 +12,14 @@ then
done done
fi fi
# Add session secret from chart
if [[ -z $BEAKER_SESSION_SECRET || -v $BEAKER_SESSION_SECRET ]];then
echo "Not all environment variables are set. Generating sessions..."
else
echo "Setting session secrets from environment variables"
paster --plugin=ckan config-tool $APP_DIR/production.ini "beaker.session.secret=$BEAKER_SESSION_SECRET"
fi
if grep -E "beaker.session.secret ?= ?$" $APP_DIR/production.ini if grep -E "beaker.session.secret ?= ?$" $APP_DIR/production.ini
then then
echo "Setting beaker.session.secret in ini file" echo "Setting beaker.session.secret in ini file"

View File

@ -12,6 +12,16 @@ then
done done
fi fi
# Add session secret from chart
if [[ -z $BEAKER_SESSION_SECRET || -v $BEAKER_SESSION_SECRET || -z $JWT_ENCODE_SECRET || -v $JWT_ENCODE_SECRET || -z $JWT_DECODE_SECRET || -v $JWT_DECODE_SECRET ]];then
echo "Not all environment variables are set. Generating sessions..."
else
echo "Setting session secrets from environment variables"
ckan config-tool $APP_DIR/production.ini "beaker.session.secret=$BEAKER_SESSION_SECRET"
ckan config-tool $APP_DIR/production.ini "api_token.jwt.encode.secret=$JWT_ENCODE_SECRET"
ckan config-tool $APP_DIR/production.ini "api_token.jwt.decode.secret=$JWT_DECODE_SECRET"
fi
if grep -E "beaker.session.secret ?= ?$" $APP_DIR/production.ini if grep -E "beaker.session.secret ?= ?$" $APP_DIR/production.ini
then then
echo "Setting secrets in ini file" echo "Setting secrets in ini file"