Browse Source

de-illysation of settings, disabling LDAP by default

Jocelyn Delande 10 years ago
parent
commit
d83c1ca9cb
2 changed files with 61 additions and 35 deletions
  1. 16 35
      coin/settings.py
  2. 45 0
      coin/settings_local.example-illyse.py

+ 16 - 35
coin/settings.py

@@ -18,35 +18,18 @@ ADMINS = (
 
 MANAGERS = ADMINS
 
-# Instance LDAP de développement:
-#   adresse du serveur : ldapdev.illyse.org
-#   port ldap: 389
-#   port ldaps: 636
-
-ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER)
-
 DATABASES = {
     # Base de donnée du SI
     'default': {
         'ENGINE': 'django.db.backends.postgresql_psycopg2',
-        'NAME': 'illyse_coin',
-        'USER': 'illyse_coin',
+        'NAME': 'coin',
+        'USER': 'coin',
         'PASSWORD': '',
         'HOST': '',  # Empty for localhost through domain sockets
         'PORT': '',  # Empty for default
     },
-    # LDAP backend pour stockage et mise à jour de données
-    'ldap': {
-        'ENGINE': 'ldapdb.backends.ldap',
-        'NAME': 'ldap://ldapdev.illyse.org:389/',
-        'TLS': True,
-        'USER': 'cn=illysedev,ou=services,o=ILLYSE,l=Villeurbanne,st=RHA,c=FR',
-        'PASSWORD': 'gfj83-E8ECgGh23JK_Ol12'
-    }
 }
 
-DATABASE_ROUTERS = ['ldapdb.router.Router']
-
 # Hosts/domain names that are valid for this site; required if DEBUG is False
 # See https://docs.djangoproject.com/en/1.5/ref/settings/#allowed-hosts
 ALLOWED_HOSTS = []
@@ -229,24 +212,20 @@ AUTHENTICATION_BACKENDS = (
 
 TEST_RUNNER = 'django.test.runner.DiscoverRunner'
 
-GRAPHITE_SERVER = "http://graphite-dev.illyse.org"
-
-# Do we use LDAP or not
-LDAP_ACTIVATE = True
-
-# LDAP Base DNs
-LDAP_USER_BASE_DN = "ou=users,ou=unix,o=ILLYSE,l=Villeurbanne,st=RHA,c=FR"
-LDAP_GROUP_BASE_DN = "ou=groups,ou=unix,o=ILLYSE,l=Villeurbanne,st=RHA,c=FR"
-VPN_CONF_BASE_DN = "ou=vpn,o=ILLYSE,l=Villeurbanne,st=RHA,c=FR"
-
-# First UID to use for users
-LDAP_USER_FIRST_UID = 2000
+GRAPHITE_SERVER = "http://localhost"
 
 # Configuration for outgoing emails
-DEFAULT_FROM_EMAIL = "adminsys@illyse.org"
+DEFAULT_FROM_EMAIL = "no-reply@example.com"
 #EMAIL_USE_TLS = True
 #EMAIL_HOST = "smtp.chezmoi.tld"
 
+# Do we use LDAP or not
+LDAP_ACTIVATE = False
+
+# Not setting them results in NameError
+LDAP_USER_BASE_DN = None
+VPN_CONF_BASE_DN = None
+
 # Membership configuration
 # Default cotisation in €, per year
 MEMBER_DEFAULT_COTISATION = 20
@@ -256,9 +235,11 @@ SESSION_COOKIE_AGE = 7200
 
 # RSS/Atom feeds to display on dashboard
 # feed name (used in template), url, max entries to display
-FEEDS = (('isp', 'http://www.illyse.net/feed/', 3),
-         ('ffdn', 'http://www.ffdn.org/fr/rss.xml', 3))
-
+# "isp" entry gets picked automatically in default index template
+FEEDS = (
+    ('ffdn', 'http://www.ffdn.org/fr/rss.xml', 3),
+#    ('isp', 'http://isp.example.com/feed/', 3),
+)
 # Surcharge les paramètres en utilisant le fichier settings_local.py
 try:
     from settings_local import *

+ 45 - 0
coin/settings_local.example-illyse.py

@@ -0,0 +1,45 @@
+LDAP_ACTIVATE = True
+
+# Instance LDAP de développement:
+#   adresse du serveur : ldapdev.illyse.org
+#   port ldap: 389
+#   port ldaps: 636
+
+ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_NEVER)
+
+DATABASES = {
+    # Base de donnée du SI
+    'default': {
+        'ENGINE': 'django.db.backends.postgresql_psycopg2',
+        'NAME': 'illyse_coin',
+        'USER': 'illyse_coin',
+        'PASSWORD': '',
+        'HOST': '',  # Empty for localhost through domain sockets
+        'PORT': '',  # Empty for default
+    },
+    # LDAP backend pour stockage et mise à jour de données
+    'ldap': {
+        'ENGINE': 'ldapdb.backends.ldap',
+        'NAME': 'ldap://ldapdev.illyse.org:389/',
+        'TLS': True,
+        'USER': 'cn=illysedev,ou=services,o=ILLYSE,l=Villeurbanne,st=RHA,c=FR',
+        'PASSWORD': 'gfj83-E8ECgGh23JK_Ol12'
+    }
+}
+
+# LDAP Base DNs
+LDAP_USER_BASE_DN = "ou=users,ou=unix,o=ILLYSE,l=Villeurbanne,st=RHA,c=FR"
+LDAP_GROUP_BASE_DN = "ou=groups,ou=unix,o=ILLYSE,l=Villeurbanne,st=RHA,c=FR"
+VPN_CONF_BASE_DN = "ou=vpn,o=ILLYSE,l=Villeurbanne,st=RHA,c=FR"
+
+# First UID to use for users
+LDAP_USER_FIRST_UID = 2000
+
+DATABASE_ROUTERS = ['ldapdb.router.Router']
+
+GRAPHITE_SERVER = "http://graphite-dev.illyse.org"
+
+DEFAULT_FROM_EMAIL = "adminsys@illyse.org"
+
+FEEDS = (('isp', 'http://www.illyse.net/feed/', 3),
+         ('ffdn', 'http://www.ffdn.org/fr/rss.xml', 3))