1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/coin_ynh.git synced 2024-09-03 18:16:26 +02:00

Merge branch 'enh-refactoring' of https://github.com/YunoHost-Apps/coin_ynh into enh-refactoring

This commit is contained in:
ljf 2019-08-24 19:59:32 +02:00
commit b19793db1e
3 changed files with 35 additions and 34 deletions

View file

@ -68,7 +68,7 @@ AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend', 'django.contrib.auth.backends.ModelBackend',
) )
AUTH_LDAP_SERVER_URI = "ldap://localhost:389" 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 = { AUTH_LDAP_USER_ATTR_MAP = {
"username": "uid", "username": "uid",
"first_name": "givenName", "first_name": "givenName",

View file

@ -1,30 +1,31 @@
location PATHTOCHANGE { #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
if ($scheme = http) { if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent; rewrite ^ https://$server_name$request_uri? permanent;
} }
try_files $uri @YNH_APP_INSTANCE_NAME; try_files $uri @__NAME__;
} }
location /protected/ { location __PATH__/protected/ {
internal; internal;
alias /opt/YNH_APP_INSTANCE_NAME/YNH_APP_INSTANCE_NAME/smedia/; alias /opt/__NAME__/__NAME__/smedia/;
} }
location PATHTOCHANGEmedia { location __PATH__/media {
alias /opt/YNH_APP_INSTANCE_NAME/media; alias /opt/__NAME__/media;
} }
location PATHTOCHANGEstatic { location __PATH__/static {
alias /opt/YNH_APP_INSTANCE_NAME/static; alias /opt/__NAME__/static;
} }
location PATHTOCHANGEassets { location __PATH__/assets {
alias /opt/YNH_APP_INSTANCE_NAME/static; alias /opt/__NAME__/static;
} }
location @YNH_APP_INSTANCE_NAME { location @__NAME__ {
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://unix:/opt/YNH_APP_INSTANCE_NAME/sock; proxy_pass http://unix:/opt/__NAME__/sock;
} }

View file

@ -79,7 +79,7 @@ export db_name=$(ynh_sanitize_dbid --db_name=$app)
export db_user=$db_name export db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$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 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 # DOWNLOAD, CHECK AND UNPACK SOURCE
@ -128,8 +128,8 @@ virtualenv "$final_path/venv"
export prefix="${path_url#"/"}/" export prefix="${path_url#"/"}/"
prefix=${prefix%"/"} prefix=${prefix%"/"}
ynh_render_template ../conf/local.py.j2 "$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/app/settings_local.py" ynh_store_file_checksum --file="$final_path/coin/settings_local.py"
#================================================= #=================================================
# SERVE STATIC FILES IN PRODUCTION MODE # SERVE STATIC FILES IN PRODUCTION MODE