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

Merge pull request #66 from YunoHost-Apps/dev

Fixed cors headers for data
This commit is contained in:
Gérard Collin 2024-05-25 14:19:21 +02:00 committed by GitHub
commit 2e2ddd0a1c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 29 additions and 9 deletions

View file

@ -32,7 +32,7 @@ This Yunohost app installs the server part (services + mongo database) needed to
- As well any documents or images uploaded by users will be backed up - As well any documents or images uploaded by users will be backed up
**Shipped version:** 0.3.2~ynh1 **Shipped version:** 0.3.2~ynh2
**Demo:** <https://dont-code.net/apps.html> **Demo:** <https://dont-code.net/apps.html>

View file

@ -32,7 +32,7 @@ This Yunohost app installs the server part (services + mongo database) needed to
- As well any documents or images uploaded by users will be backed up - As well any documents or images uploaded by users will be backed up
**Versión actual:** 0.3.2~ynh1 **Versión actual:** 0.3.2~ynh2
**Demo:** <https://dont-code.net/apps.html> **Demo:** <https://dont-code.net/apps.html>

View file

@ -32,7 +32,7 @@ This Yunohost app installs the server part (services + mongo database) needed to
- As well any documents or images uploaded by users will be backed up - As well any documents or images uploaded by users will be backed up
**Paketatutako bertsioa:** 0.3.2~ynh1 **Paketatutako bertsioa:** 0.3.2~ynh2
**Demoa:** <https://dont-code.net/apps.html> **Demoa:** <https://dont-code.net/apps.html>

View file

@ -32,7 +32,7 @@ This Yunohost app installs the server part (services + mongo database) needed to
- As well any documents or images uploaded by users will be backed up - As well any documents or images uploaded by users will be backed up
**Version incluse:** 0.3.2~ynh1 **Version incluse:** 0.3.2~ynh2
**Démo:** <https://dont-code.net/apps.html> **Démo:** <https://dont-code.net/apps.html>

View file

@ -32,7 +32,7 @@ This Yunohost app installs the server part (services + mongo database) needed to
- As well any documents or images uploaded by users will be backed up - As well any documents or images uploaded by users will be backed up
**Versión proporcionada:** 0.3.2~ynh1 **Versión proporcionada:** 0.3.2~ynh2
**Demo:** <https://dont-code.net/apps.html> **Demo:** <https://dont-code.net/apps.html>

View file

@ -32,7 +32,7 @@ This Yunohost app installs the server part (services + mongo database) needed to
- As well any documents or images uploaded by users will be backed up - As well any documents or images uploaded by users will be backed up
**分发版本:** 0.3.2~ynh1 **分发版本:** 0.3.2~ynh2
**演示:** <https://dont-code.net/apps.html> **演示:** <https://dont-code.net/apps.html>

View file

@ -8,6 +8,7 @@ location __PATH__/ {
# Handling preflight requests # Handling preflight requests
if ($request_method = OPTIONS) { if ($request_method = OPTIONS) {
more_set_headers 'Access-Control-Allow-Methods: *' 'Access-Control-Allow-Headers: *'; more_set_headers 'Access-Control-Allow-Methods: *' 'Access-Control-Allow-Headers: *';
return 200;
} }
# Path to source # Path to source
@ -37,6 +38,10 @@ location __PATH__/ {
} }
location __PATH__/project { location __PATH__/project {
if ($request_method = OPTIONS) {
more_set_headers 'Access-Control-Allow-Methods: *' 'Access-Control-Allow-Headers: *';
return 200;
}
proxy_pass http://localhost:__PORT_PROJECT__/project; proxy_pass http://localhost:__PORT_PROJECT__/project;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_read_timeout 86400s; proxy_read_timeout 86400s;
@ -44,6 +49,10 @@ location __PATH__/ {
} }
location __PATH__/data { location __PATH__/data {
if ($request_method = OPTIONS) {
more_set_headers 'Access-Control-Allow-Methods: *' 'Access-Control-Allow-Headers: *';
return 200;
}
proxy_pass http://localhost:__PORT_DATA__/data; proxy_pass http://localhost:__PORT_DATA__/data;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_read_timeout 86400s; proxy_read_timeout 86400s;
@ -51,6 +60,10 @@ location __PATH__/ {
} }
location __PATH__/documents { location __PATH__/documents {
if ($request_method = OPTIONS) {
more_set_headers 'Access-Control-Allow-Methods: *' 'Access-Control-Allow-Headers: *';
return 200;
}
proxy_pass http://localhost:__PORT_DATA__/documents; proxy_pass http://localhost:__PORT_DATA__/documents;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_read_timeout 86400s; proxy_read_timeout 86400s;

View file

@ -7,7 +7,7 @@ name = "Dont-code Services"
description.en = "Install services and databases needed to support Dont-code platform" description.en = "Install services and databases needed to support Dont-code platform"
description.fr = "Installe les services et base de données nécessaires pour utiliser la plateforme Dont-code" description.fr = "Installe les services et base de données nécessaires pour utiliser la plateforme Dont-code"
version = "0.3.2~ynh1" version = "0.3.2~ynh2"
maintainers = ["Dont-code Team"] maintainers = ["Dont-code Team"]
@ -20,7 +20,7 @@ userdoc = "https://dont-code.net/news.html"
code = "https://github.com/dont-code" code = "https://github.com/dont-code"
[integration] [integration]
yunohost = ">= 11.0.0" yunohost = ">= 11.1.9"
architectures = "all" architectures = "all"
multi_instance = true multi_instance = true
ldap = false ldap = false

View file

@ -314,6 +314,7 @@ ynh_install_mongo() {
ynh_print_info --message="Installing MongoDB Community Edition ..." ynh_print_info --message="Installing MongoDB Community Edition ..."
local mongo_debian_release=$(ynh_get_debian_release) local mongo_debian_release=$(ynh_get_debian_release)
local mongo_packages="mongodb-org"
if [[ $(cat /proc/cpuinfo) != *"avx"* && "$mongo_version" != "4.4" ]]; then if [[ $(cat /proc/cpuinfo) != *"avx"* && "$mongo_version" != "4.4" ]]; then
#Sadly mongo 4.4 is the only version not requiring avx instruction set, so we will install it #Sadly mongo 4.4 is the only version not requiring avx instruction set, so we will install it
@ -321,7 +322,13 @@ ynh_install_mongo() {
mongo_version="4.4" mongo_version="4.4"
fi fi
ynh_install_extra_app_dependencies --repo="deb http://repo.mongodb.org/apt/debian $mongo_debian_release/mongodb-org/$mongo_version main" --package="mongodb-org" --key="https://www.mongodb.org/static/pgp/server-$mongo_version.asc" if [[ "$mongo_version" == "4.4" ]]; then
ynh_print_warn --message="Switching to buster package install for Mongo 4.4."
mongo_debian_release=buster
mongo_packages="mongodb-org-server mongodb-database-tools mongodb-mongosh-shared-openssl11"
fi
ynh_install_extra_app_dependencies --repo="deb http://repo.mongodb.org/apt/debian $mongo_debian_release/mongodb-org/$mongo_version main" --package="$mongo_packages" --key="https://www.mongodb.org/static/pgp/server-$mongo_version.asc"
mongodb_servicename=mongod mongodb_servicename=mongod
# Make sure MongoDB is started and enabled # Make sure MongoDB is started and enabled