mirror of
https://github.com/YunoHost-Apps/lufi_ynh.git
synced 2024-09-03 19:36:28 +02:00
Use add_config rather than various replace_string
This commit is contained in:
parent
223706b1e9
commit
8d3a052a23
4 changed files with 40 additions and 73 deletions
|
@ -59,7 +59,7 @@
|
|||
# max file size, in octets
|
||||
# you can write it 100*1024*1024
|
||||
# optional, no default
|
||||
max_file_size => __MAX_FILE_SIZE__*1024*1024,
|
||||
__MAX_SIZE_SET__max_file_size => __MAX_FILE_SIZE__*1024*1024,
|
||||
|
||||
# if you want to have piwik statistics, provide a piwik image tracker
|
||||
# only the image tracker is allowed, no javascript
|
||||
|
@ -199,20 +199,20 @@
|
|||
# set `ldap` if you want that only authenticated users can upload files
|
||||
# please note that everybody can still download files
|
||||
# optional, no default
|
||||
__USE_LDAP__ldap => {
|
||||
__USE_LDAP__ uri => 'ldap://localhost:389', # server URI
|
||||
__USE_LDAP__ user_tree => 'dc=yunohost,dc=org', # search base DN
|
||||
__USE_LDAP__ bind_dn => 'ou=users,dc=yunohost,dc=org', # search bind DN
|
||||
__USE_LDAP__ #bind_pwd => 'secr3t', # search bind password
|
||||
__USE_LDAP__ user_attr => 'uid', # user attribute (uid, mail, sAMAccountName, etc.)
|
||||
__USE_LDAP__ user_filter => '(&(objectClass=posixAccount)(permission=cn=__APP__.main,ou=permission,dc=yunohost,dc=org))', # user filter (to exclude some users, etc.)
|
||||
__USE_LDAP__ # optional start_tls configuration. See https://metacpan.org/pod/distribution/perl-ldap/lib/Net/LDAP.pod#start_tls
|
||||
__USE_LDAP__ # don't set or uncomment if you don't want to configure it
|
||||
__USE_LDAP__ #start_tls => {
|
||||
__USE_LDAP__ # verify => 'optional',
|
||||
__USE_LDAP__ # clientcert => '/etc/ssl/certs/ca-bundle.pem'
|
||||
__USE_LDAP__ #}
|
||||
__USE_LDAP__},
|
||||
__LDAP__ldap => {
|
||||
__LDAP__ uri => 'ldap://localhost:389', # server URI
|
||||
__LDAP__ user_tree => 'dc=yunohost,dc=org', # search base DN
|
||||
__LDAP__ bind_dn => 'ou=users,dc=yunohost,dc=org', # search bind DN
|
||||
__LDAP__ #bind_pwd => 'secr3t', # search bind password
|
||||
__LDAP__ user_attr => 'uid', # user attribute (uid, mail, sAMAccountName, etc.)
|
||||
__LDAP__ user_filter => '(&(objectClass=posixAccount)(permission=cn=__APP__.main,ou=permission,dc=yunohost,dc=org))', # user filter (to exclude some users, etc.)
|
||||
__LDAP__ # optional start_tls configuration. See https://metacpan.org/pod/distribution/perl-ldap/lib/Net/LDAP.pod#start_tls
|
||||
__LDAP__ # don't set or uncomment if you don't want to configure it
|
||||
__LDAP__ #start_tls => {
|
||||
__LDAP__ # verify => 'optional',
|
||||
__LDAP__ # clientcert => '/etc/ssl/certs/ca-bundle.pem'
|
||||
__LDAP__ #}
|
||||
__LDAP__},
|
||||
|
||||
# if you've set ldap above, the session will last `session_duration` seconds before
|
||||
# the user needs to reauthenticate
|
||||
|
|
|
@ -119,28 +119,18 @@ ynh_script_progression --message="Configuring lufi..."
|
|||
domain="$new_domain"
|
||||
path_url="$new_path"
|
||||
|
||||
config=${final_path}/lufi.conf
|
||||
ynh_backup_if_checksum_is_different --file="$config"
|
||||
cp ../conf/lufi.conf.template "$config"
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config"
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$config"
|
||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config"
|
||||
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config"
|
||||
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$config"
|
||||
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config"
|
||||
ynh_replace_string --match_string="__MAX_FILE_SIZE__" --replace_string="$max_file_size" --target_file="$config"
|
||||
if [ $max_file_size -eq 0 ]; then # Comment the limitation line if no limit
|
||||
ynh_replace_string --match_string="max_file_size" --replace_string="#max_file_size" --target_file="$config"
|
||||
fi
|
||||
ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="$config"
|
||||
ldap="#"
|
||||
if [ $use_ldap -eq 1 ];
|
||||
then
|
||||
ynh_replace_string --match_string="__USE_LDAP__" --replace_string="" --target_file="$config"
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$config"
|
||||
else
|
||||
ynh_replace_string --match_string="__USE_LDAP__" --replace_string="#" --target_file="$config"
|
||||
ldap=""
|
||||
fi
|
||||
ynh_store_file_checksum --file="$config"
|
||||
|
||||
max_size_set=""
|
||||
if [ $max_file_size -eq 0 ]; then # Comment the limitation line if no limit
|
||||
max_size_set="#"
|
||||
fi
|
||||
|
||||
ynh_add_config --template="../conf/lufi.conf.template" --destination="$final_path/lufi.conf"
|
||||
|
||||
chmod 600 $final_path/lufi.conf
|
||||
chown $app:$app $final_path/lufi.conf
|
||||
|
|
|
@ -126,29 +126,18 @@ ynh_add_nginx_config max_file_size
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring $app..."
|
||||
|
||||
config=${final_path}/lufi.conf
|
||||
cp ../conf/lufi.conf.template "$config"
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config"
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$config"
|
||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config"
|
||||
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config"
|
||||
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$config"
|
||||
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config"
|
||||
ynh_replace_string --match_string="__MAX_FILE_SIZE__" --replace_string="$max_file_size" --target_file="$config"
|
||||
if [ $max_file_size -eq 0 ]; then # Comment the limitation line if no limit
|
||||
ynh_replace_string --match_string="max_file_size" --replace_string="#max_file_size" --target_file="$config"
|
||||
fi
|
||||
ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="$config"
|
||||
|
||||
ldap="#"
|
||||
if [ $use_ldap -eq 1 ];
|
||||
then
|
||||
ynh_replace_string --match_string="__USE_LDAP__" --replace_string="" --target_file="$config"
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$config"
|
||||
else
|
||||
ynh_replace_string --match_string="__USE_LDAP__" --replace_string="#" --target_file="$config"
|
||||
ldap=""
|
||||
fi
|
||||
|
||||
ynh_store_file_checksum --file="$config"
|
||||
max_size_set=""
|
||||
if [ $max_file_size -eq 0 ]; then # Comment the limitation line if no limit
|
||||
max_size_set="#"
|
||||
fi
|
||||
|
||||
ynh_add_config --template="../conf/lufi.conf.template" --destination="$final_path/lufi.conf"
|
||||
|
||||
chmod 600 $final_path/lufi.conf
|
||||
chown $app:$app $final_path/lufi.conf
|
||||
|
|
|
@ -156,30 +156,18 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring Lufi..."
|
||||
|
||||
config=${final_path}/lufi.conf
|
||||
ynh_backup_if_checksum_is_different --file="$config"
|
||||
cp ../conf/lufi.conf.template "$config"
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config"
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$config"
|
||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$config"
|
||||
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config"
|
||||
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$config"
|
||||
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config"
|
||||
ynh_replace_string --match_string="__MAX_FILE_SIZE__" --replace_string="$max_file_size" --target_file="$config"
|
||||
if [ $max_file_size -eq 0 ]; then # Comment the limitation line if no limit
|
||||
ynh_replace_string --match_string="max_file_size" --replace_string="#max_file_size" --target_file="$config"
|
||||
fi
|
||||
ynh_replace_string --match_string="__SECRET__" --replace_string="$secret" --target_file="$config"
|
||||
|
||||
ldap="#"
|
||||
if [ $use_ldap -eq 1 ];
|
||||
then
|
||||
ynh_replace_string --match_string="__USE_LDAP__" --replace_string="" --target_file="$config"
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$config"
|
||||
else
|
||||
ynh_replace_string --match_string="__USE_LDAP__" --replace_string="#" --target_file="$config"
|
||||
ldap=""
|
||||
fi
|
||||
|
||||
ynh_store_file_checksum --file="$config"
|
||||
max_size_set=""
|
||||
if [ $max_file_size -eq 0 ]; then # Comment the limitation line if no limit
|
||||
max_size_set="#"
|
||||
fi
|
||||
|
||||
ynh_add_config --template="../conf/lufi.conf.template" --destination="$final_path/lufi.conf"
|
||||
|
||||
chmod 600 $final_path/lufi.conf
|
||||
chown $app:$app $final_path/lufi.conf
|
||||
|
|
Loading…
Add table
Reference in a new issue