#!/bin/bash
set -e

cp /etc/horizon/local_settings.py $HORIZON_VENV_DIR/lib/python2.7/site-packages/openstack_dashboard/local/local_settings.py

# TODO(shadower) workaround for:
# https://bugs.launchpad.net/os-apply-config/+bug/1246266
chmod 600 /etc/horizon/.secret_key_store
chown horizon:horizon /etc/horizon/.secret_key_store

# Precompile the Horizon assets. Can't do it in install.d because it depends on
# the local_settings.py config file.
source $HORIZON_VENV_DIR/bin/activate
DJANGO_SETTINGS_MODULE=openstack_dashboard.settings django-admin.py compress
