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

Simplified configs variable addition using format __FOO__.

This commit is contained in:
squeak 2021-03-12 07:50:04 +01:00
parent 4cd650c262
commit 938c385882
7 changed files with 11 additions and 25 deletions

View file

@ -6,4 +6,4 @@ enable_cors = true
credentials = true credentials = true
headers = accept, authorization, content-type, origin, referer headers = accept, authorization, content-type, origin, referer
methods = GET, PUT, POST, HEAD, DELETE methods = GET, PUT, POST, HEAD, DELETE
origins = https://{{{domain}}} origins = https://__DOMAIN__

View file

@ -6,18 +6,18 @@ module.exports = {
debug: false, debug: false,
refreshServiceWorkerScriptAtEachRequest: false, refreshServiceWorkerScriptAtEachRequest: false,
port: "{{{port}}}", port: "__PORT__",
authentication: { authentication: {
couchUrl: "{{{couch_url}}}", couchUrl: "__COUCH_URL__",
}, },
couchAdminAuthentication: { couchAdminAuthentication: {
// couch admin user: // couch admin user:
username: "{{{couch_admin_name}}}", username: "__COUCH_ADMIN_NAME__",
// couch admin user's password: // couch admin user's password:
password: "{{{couch_admin_password}}}", password: "__COUCH_ADMIN_PASSWORD__",
// the url where your couchdb server is accessible from the internet: // the url where your couchdb server is accessible from the internet:
customCouchUrl: "{{{couch_url}}}", customCouchUrl: "__COUCH_URL__",
}, },
}; };

View file

@ -6,6 +6,6 @@ module.exports = {
debug: false, debug: false,
refreshServiceWorkerScriptAtEachRequest: false, refreshServiceWorkerScriptAtEachRequest: false,
port: "{{{port}}}", port: "__PORT__",
}; };

View file

@ -1,7 +1,7 @@
module.exports = { module.exports = {
adminEmail: "{{{admin_email}}}", adminEmail: "__ADMIN_EMAIL__",
otherOptionsThanLogin: [ otherOptionsThanLogin: [
"If you have no dato account, you should request one to the administrator of this server.", "If you have no dato account, you should request one to the administrator of this server.",

View file

@ -121,12 +121,12 @@
"name": "admin_email", "name": "admin_email",
"type": "string", "type": "string",
"ask": { "ask": {
"en": "If you want the dato administrator email to be displayed in login page, so that users can contact you to create accounts... you can set your email here. Otherwise leave this to 'none'. (only if autosynchronization is enabled)", "en": "If you want the dato administrator email to be displayed in login page, so that users can contact you to create accounts... you can set your email here. Otherwise leave this empty. (only useful if autosynchronization is enabled)",
"fr": "Si tu souhaites que l'email de l'administrateur de dato soit visible sur la page de login, afin que les utilisateurs puissent le contacter pour des demandes de compte... tu peux le spécifier ici. Sinon, choisis 'none'. (nécessaire uniquement si l'autosynchronisation a été activée)" "fr": "Si tu souhaites que l'email de l'administrateur de dato soit visible sur la page de login, afin que les utilisateurs puissent le contacter pour des demandes de compte... tu peux le spécifier ici. Sinon, laisser ce champ vide. (utile uniquement si l'autosynchronisation a été activée)"
}, },
"example": "datoadmin((at))domain.tld", "example": "datoadmin((at))domain.tld",
"optional": true, "optional": true,
"default" : "none" "default" : ""
} }
] ]
} }

View file

@ -25,22 +25,9 @@ dato_setup_config_files() {
# setup private dato config # setup private dato config
if [[ $autosynchronize == true ]]; then if [[ $autosynchronize == true ]]; then
ynh_add_config --template="../conf/private-autosync.js" --destination="$final_path/config/private.js" ynh_add_config --template="../conf/private-autosync.js" --destination="$final_path/config/private.js"
# setup couch url, admin name and password
ynh_replace_string --match_string="{{{couch_url}}}" --replace_string="$couch_url" --target_file="$final_path/config/private.js"
ynh_replace_string --match_string="{{{couch_admin_name}}}" --replace_string="$couch_admin_name" --target_file="$final_path/config/private.js"
ynh_replace_string --match_string="{{{couch_admin_password}}}" --replace_string="$couch_admin_password" --target_file="$final_path/config/private.js"
else else
ynh_add_config --template="../conf/private.js" --destination="$final_path/config/private.js" ynh_add_config --template="../conf/private.js" --destination="$final_path/config/private.js"
fi fi
# setup port to use
ynh_replace_string --match_string="{{{port}}}" --replace_string="$port" --target_file="$final_path/config/private.js"
# add admin email to public config if it was set
if [[ $admin_email != "none" ]]; then
ynh_replace_string --match_string="{{{admin_email}}}" --replace_string="$admin_email" --target_file="$final_path/config/public.js"
else
ynh_replace_string --match_string="{{{admin_email}}}" --replace_string="" --target_file="$final_path/config/public.js"
fi
} }

View file

@ -181,7 +181,6 @@ if [[ $autosynchronize == true ]]; then
# make sure that couchdb has CORS enabled and that it accepts requests from dato domain # make sure that couchdb has CORS enabled and that it accepts requests from dato domain
ynh_add_config --template="../conf/couch.ini" --destination="/opt/couchdb/etc/local.d/$app.ini" ynh_add_config --template="../conf/couch.ini" --destination="/opt/couchdb/etc/local.d/$app.ini"
ynh_replace_string --match_string="{{{domain}}}" --replace_string="$domain" --target_file="/opt/couchdb/etc/local.d/$app.ini"
ynh_store_file_checksum --file="/opt/couchdb/etc/local.d/$app.ini" ynh_store_file_checksum --file="/opt/couchdb/etc/local.d/$app.ini"