diff --git a/conf/local.py.j2 b/conf/local.py.j2 index 125caa7..4a2777b 100644 --- a/conf/local.py.j2 +++ b/conf/local.py.j2 @@ -68,7 +68,7 @@ AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', ) AUTH_LDAP_SERVER_URI = "ldap://localhost:389" -AUTH_LDAP_USER_SEARCH = LDAPSearch("uid=YNH_APP_ARG_ADMIN,ou=users,dc=yunohost,dc=org", ldap.SCOPE_SUBTREE, "(uid=%(user)s)") +AUTH_LDAP_USER_SEARCH = LDAPSearch("uid={{ admin }},ou=users,dc=yunohost,dc=org", ldap.SCOPE_SUBTREE, "(uid=%(user)s)") AUTH_LDAP_USER_ATTR_MAP = { "username": "uid", "first_name": "givenName", diff --git a/conf/nginx.conf b/conf/nginx.conf index 27fcfcc..36fa9f3 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,30 +1,31 @@ -location PATHTOCHANGE { - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - try_files $uri @YNH_APP_INSTANCE_NAME; -} -location /protected/ { - internal; - alias /opt/YNH_APP_INSTANCE_NAME/YNH_APP_INSTANCE_NAME/smedia/; -} - -location PATHTOCHANGEmedia { - alias /opt/YNH_APP_INSTANCE_NAME/media; -} - -location PATHTOCHANGEstatic { - alias /opt/YNH_APP_INSTANCE_NAME/static; -} - -location PATHTOCHANGEassets { - alias /opt/YNH_APP_INSTANCE_NAME/static; -} - -location @YNH_APP_INSTANCE_NAME { - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_pass http://unix:/opt/YNH_APP_INSTANCE_NAME/sock; -} +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location __PATH__/ { + if ($scheme = http) { + rewrite ^ https://$server_name$request_uri? permanent; + } + try_files $uri @__NAME__; +} +location __PATH__/protected/ { + internal; + alias /opt/__NAME__/__NAME__/smedia/; +} + +location __PATH__/media { + alias /opt/__NAME__/media; +} + +location __PATH__/static { + alias /opt/__NAME__/static; +} + +location __PATH__/assets { + alias /opt/__NAME__/static; +} + +location @__NAME__ { + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_pass http://unix:/opt/__NAME__/sock; +} diff --git a/scripts/install b/scripts/install index 7dc9384..23f9e5d 100644 --- a/scripts/install +++ b/scripts/install @@ -79,7 +79,7 @@ export db_name=$(ynh_sanitize_dbid --db_name=$app) export db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_psql_setup_db --db_user=$db_user --db_name=$db_name -export db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) +export db_pwd #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -128,8 +128,8 @@ virtualenv "$final_path/venv" export prefix="${path_url#"/"}/" prefix=${prefix%"/"} -ynh_render_template ../conf/local.py.j2 "$final_path/app/settings_local.py" -ynh_store_file_checksum --file="$final_path/app/settings_local.py" +ynh_render_template ../conf/local.py.j2 "$final_path/coin/settings_local.py" +ynh_store_file_checksum --file="$final_path/coin/settings_local.py" #================================================= # SERVE STATIC FILES IN PRODUCTION MODE