radius: fix settings_local.py
This commit is contained in:
parent
99070ed5ef
commit
8ce63d14b6
3 changed files with 49 additions and 6 deletions
|
@ -20,9 +20,11 @@
|
|||
|
||||
- name: Template local re2o settings
|
||||
template:
|
||||
src: settings_local.py.j2
|
||||
dest: "/var/www/re2o/re2o/settings_local.py"
|
||||
|
||||
src: "{{ item }}.j2"
|
||||
dest: "/var/www/re2o/re2o/{{ item }}"
|
||||
loop:
|
||||
- settings_local.py
|
||||
- local_routers.py
|
||||
|
||||
|
||||
# What follows is a hideous abomination.
|
||||
|
|
28
roles/radius/templates/local_routers.py.j2
Normal file
28
roles/radius/templates/local_routers.py.j2
Normal file
|
@ -0,0 +1,28 @@
|
|||
class DbRouter(object):
|
||||
"""
|
||||
A router to control all database operations on models in the
|
||||
auth application.
|
||||
"""
|
||||
def db_for_read(self, model, **hints):
|
||||
"""
|
||||
Attempts to read remote models go to local database.
|
||||
"""
|
||||
return 'default'
|
||||
|
||||
def db_for_write(self, model, **hints):
|
||||
"""
|
||||
Attempts to write remote models go to the remote database.
|
||||
"""
|
||||
return 'master'
|
||||
|
||||
def allow_relation(self, obj1, obj2, **hints):
|
||||
"""
|
||||
Allow relations involving the remote database
|
||||
"""
|
||||
return True
|
||||
|
||||
def allow_migrate(self, db, app_label, model_name=None, **hints):
|
||||
"""
|
||||
Allow migrations on the remote database
|
||||
"""
|
||||
return True
|
|
@ -44,14 +44,14 @@ DEBUG = False
|
|||
ADMINS = [('AURORE', 'monitoring.aurore@lists.crans.org'), ('Gabriel Detraz', 'detraz@crans.org')]
|
||||
|
||||
# The list of hostname the server will respond to.
|
||||
ALLOWED_HOSTS = ['radius-pacaterie.adm.auro.re']
|
||||
ALLOWED_HOSTS = ['{{ inventory_hostname }}']
|
||||
|
||||
# The time zone the server is runned in
|
||||
TIME_ZONE = 'Europe/Paris'
|
||||
|
||||
# The storage systems parameters to use
|
||||
DATABASES = {
|
||||
'default': { # The DB
|
||||
'master': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'NAME': 're2o',
|
||||
'USER': 're2o',
|
||||
|
@ -62,7 +62,18 @@ DATABASES = {
|
|||
'COLLATION': 'utf8_general_ci'
|
||||
}
|
||||
},
|
||||
'ldap': { # The LDAP
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'NAME': 're2o',
|
||||
'USER': 're2o_ro',
|
||||
'PASSWORD': "{{ radius_pg_re2o_ro_password }}",
|
||||
'HOST': 'localhost',
|
||||
'TEST': {
|
||||
'CHARSET': 'utf8',
|
||||
'COLLATION': 'utf8_general_ci'
|
||||
}
|
||||
},
|
||||
'ldap': {
|
||||
'ENGINE': 'ldapdb.backends.ldap',
|
||||
'NAME': 'ldap://10.128.0.11/',
|
||||
'USER': 'cn=admin,dc=auro,dc=re',
|
||||
|
@ -114,3 +125,5 @@ OPTIONNAL_APPS_RE2O = ()
|
|||
|
||||
# Some Django apps you want to add in you local project
|
||||
OPTIONNAL_APPS = OPTIONNAL_APPS_RE2O + ()
|
||||
|
||||
LOCAL_ROUTERS = ["re2o.local_routers.DbRouter"]
|
||||
|
|
Loading…
Reference in a new issue