From 4fa98c37920be94e7e275d88c5d5d5f250f8fd4d Mon Sep 17 00:00:00 2001 From: Stefan Pratter Date: Fri, 9 Nov 2018 07:27:36 +0000 Subject: [PATCH] fix init.sql inclusion --- .gitignore | 1 - config/facsimile/tmpl/_ALL_/init.sql | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 config/facsimile/tmpl/_ALL_/init.sql diff --git a/.gitignore b/.gitignore index 208e83d5..0dabc837 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ .facsimile *.pyc *.log -*.sql *.swp OLD.* genstatic/ diff --git a/config/facsimile/tmpl/_ALL_/init.sql b/config/facsimile/tmpl/_ALL_/init.sql new file mode 100644 index 00000000..d026d702 --- /dev/null +++ b/config/facsimile/tmpl/_ALL_/init.sql @@ -0,0 +1,23 @@ + +{% for k, each in module.iteritems() %} + {% if each.db %} + {% if each.db.name %} +create database if not exists {{env.rc.db.prefix}}{{each.db.name}} character set = utf8; +grant all on {{env.rc.db.prefix}}{{each.db.name}}.* to '{{env.rc.db.prefix}}{{each.name}}'@'localhost' identified by '{{each.password}}'; +grant all on {{env.rc.db.prefix}}{{each.db.name}}.* to '{{env.rc.db.prefix}}{{each.name}}'@'%.%.int' identified by '{{each.password}}'; + {% endif %} + + {% for table in each.db.selectable %} +grant select on {{table}} to '{{env.rc.db.prefix}}{{each.name}}'@'localhost' identified by '{{each.password}}'; +grant select on {{table}} to '{{env.rc.db.prefix}}{{each.name}}'@'%.%.int' identified by '{{each.password}}'; + {% endfor %} + {% for table in each.db.writable %} +grant all on {{table}} to '{{env.rc.db.prefix}}{{each.name}}'@'localhost' identified by '{{each.password}}'; +grant all on {{table}} to '{{env.rc.db.prefix}}{{each.name}}'@'%.%.int' identified by '{{each.password}}'; + {% endfor %} + + {% endif %} +{% endfor %} + +flush privileges; +