aboutsummaryrefslogtreecommitdiffstats
path: root/moonv4/templates/docker/keystone/run.sh
diff options
context:
space:
mode:
authorasteroide <thomas.duval@orange.com>2017-05-17 10:09:16 +0200
committerasteroide <thomas.duval@orange.com>2017-05-17 10:09:16 +0200
commit725e85c2b8515126845cdbf8ece1f32e612a7687 (patch)
treeeb5d8aec88a98654372d35c19890ec2152ae06c5 /moonv4/templates/docker/keystone/run.sh
parent934a83a28818f3f5f51d1666e22af075ce3b096a (diff)
Add CORS to Keystone
Change-Id: Ie705bf519d880fa3a20ce61ca75f501f2fa93a62
Diffstat (limited to 'moonv4/templates/docker/keystone/run.sh')
-rw-r--r--moonv4/templates/docker/keystone/run.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/moonv4/templates/docker/keystone/run.sh b/moonv4/templates/docker/keystone/run.sh
index 7c9a1a43..1442807b 100644
--- a/moonv4/templates/docker/keystone/run.sh
+++ b/moonv4/templates/docker/keystone/run.sh
@@ -6,11 +6,21 @@ echo DB_HOST=$DB_HOST
echo DB_DATABASE=$DB_DATABASE
echo RABBIT_NODE=$RABBIT_NODE
echo RABBIT_NODE=$[RABBIT_NODE]
+echo INTERFACE_HOST=$INTERFACE_HOST
sed "s/#admin_token = <None>/admin_token=$ADMIN_TOKEN/g" -i /etc/keystone/keystone.conf
sed "s/connection = sqlite:\/\/\/\/var\/lib\/keystone\/keystone.db/connection = $DB_CONNECTION:\/\/$DB_USER:$DB_PASSWORD@$DB_HOST\/$DB_DATABASE/g" -i /etc/keystone/keystone.conf
sed "s/#driver = sql/driver = $DB_DRIVER/g" -i /etc/keystone/keystone.conf
+cat << EOF | tee -a /etc/keystone/keystone.conf
+[cors]
+allowed_origin = $INTERFACE_HOST
+max_age = 3600
+allow_methods = GET,POST,PUT,DELETE
+allow_headers = Content-Type,Cache-Control,Content-Language,Expires,Last-Modified,Pragma,X-Custom-Header
+expose_headers = Content-Type,Cache-Control,Content-Language,Expires,Last-Modified,Pragma,X-Custom-Header
+EOF
+
mysql -h $DB_HOST -u$DB_USER_ROOT -p$DB_PASSWORD_ROOT <<EOF
CREATE DATABASE $DB_DATABASE DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
GRANT ALL ON $DB_DATABASE.* TO '$DB_USER'@'%' IDENTIFIED BY '$DB_PASSWORD';