mirror of
https://github.com/YunoHost-Apps/librephotos_ynh.git
synced 2024-09-03 19:36:12 +02:00
67 lines
1.7 KiB
Diff
67 lines
1.7 KiB
Diff
diff --git a/ownphotos/settings.py b/ownphotos/settings.py
|
|
index 3449af1..f1a6be7 100644
|
|
--- a/ownphotos/settings.py
|
|
+++ b/ownphotos/settings.py
|
|
@@ -11,6 +11,7 @@
|
|
"""
|
|
import datetime
|
|
import os
|
|
+import ldap, tzlocal
|
|
|
|
for envvar in (
|
|
"SECRET_KEY",
|
|
@@ -77,7 +78,7 @@
|
|
"IMAGE_DIRS": ("/data", "Image dirs list (serialized json)", str),
|
|
}
|
|
|
|
-INTERNAL_IPS = ("127.0.0.1", "localhost", "192.168.1.100")
|
|
+INTERNAL_IPS = ("127.0.0.1", "localhost")
|
|
|
|
CORS_ALLOW_HEADERS = (
|
|
"cache-control",
|
|
@@ -94,7 +95,11 @@
|
|
"x-requested-with",
|
|
)
|
|
|
|
-CORS_ORIGIN_WHITELIST = ("http://localhost:3000", "http://192.168.1.100:3000")
|
|
+BACKEND_PORT=os.environ['httpPort']
|
|
+
|
|
+CORS_ORIGIN_WHITELIST = [
|
|
+ 'http://localhost:' + BACKEND_PORT,
|
|
+]
|
|
|
|
REST_FRAMEWORK = {
|
|
"DEFAULT_PERMISSION_CLASSES": ("rest_framework.permissions.IsAuthenticated",),
|
|
@@ -219,7 +224,7 @@
|
|
|
|
LANGUAGE_CODE = "en-us"
|
|
|
|
-TIME_ZONE = os.environ["TIME_ZONE"]
|
|
+TIME_ZONE = tzlocal.get_localzone().zone
|
|
|
|
USE_I18N = True
|
|
|
|
@@ -258,8 +263,8 @@
|
|
CORS_ORIGIN_ALLOW_ALL = False
|
|
CORS_ALLOW_CREDENTIALS = True
|
|
|
|
-IMAGE_SIMILARITY_SERVER = "http://localhost:8002"
|
|
-
|
|
+IMAGE_SIMILARITY_SERVER_PORT=os.environ['IMAGE_SIMILARITY_SERVER_PORT']
|
|
+IMAGE_SIMILARITY_SERVER = 'http://localhost:' + IMAGE_SIMILARITY_SERVER_PORT
|
|
|
|
# Must be less or egal of nb core CPU ( Nearly 2GB per process)
|
|
HEAVYWEIGHT_PROCESS_ENV = os.environ.get("HEAVYWEIGHT_PROCESS", "1")
|
|
@@ -282,3 +287,12 @@
|
|
},
|
|
},
|
|
}
|
|
+
|
|
+AUTHENTICATION_BACKENDS = [
|
|
+ "django_auth_ldap.backend.LDAPBackend",
|
|
+ "django.contrib.auth.backends.ModelBackend",
|
|
+]
|
|
+
|
|
+AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,ou=users,dc=yunohost,dc=org"
|
|
+
|
|
+AUTH_LDAP_USER_ATTR_MAP = {"username": "uid", "first_name": "givenName", "email": "mail", "last_name": "sn"}
|