diff --git a/conf/server.json b/conf/server.json index 76f4068..e465494 100644 --- a/conf/server.json +++ b/conf/server.json @@ -5,19 +5,16 @@ "Group": "Servers", "Host": "localhost", "Port": 5432, + "MaintenanceDB": "postgres", "Username": "__DB_USER__", "Role": "__DB_USER__", - "MaintenanceDB": "postgres", - - "SSLMode": "prefer", - - "Timeout": 10, - - "DBRestriction": "live_db test_db", - "PassFile": "/path/to/pgpassfile", "Shared": false, - "Service": "", - "PasswordExecCommand": "echo '__DB_PWD__'" + "DBRestriction": "live_db test_db", + "KerberosAuthentication": false, + "ConnectionParameters": { + "sslmode": "prefer", + "connect_timeout": 10 + } } } } diff --git a/scripts/install b/scripts/install index 42ddedc..bbe6fe8 100644 --- a/scripts/install +++ b/scripts/install @@ -17,6 +17,13 @@ source /usr/share/yunohost/helpers # Used in expect script email=$(ynh_user_get_info --username $admin --key 'mail') +#================================================= +# Postgresql superuser +#================================================= +ynh_script_progression --message="Configuring Postgresql superuser..." + +ynh_psql_execute_as_root --sql "ALTER USER $app WITH SUPERUSER CREATEDB CREATEROLE REPLICATION" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -30,31 +37,16 @@ setup_dir #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." --weight=1 +ynh_script_progression --message="Configuring pgAdmin..." --weight=1 -# CONFIGURE PGADMIN ynh_add_config --template="config_local.py" --destination="$install_dir/venv/lib/python$python_version/site-packages/pgadmin4/config_local.py" -ynh_script_progression --message="Configuring $app..." - ynh_add_config --template="setup.exp" --destination="$install_dir/setup.exp" chmod +x "$install_dir/setup.exp" -"$install_dir/setup.exp" "$install_dir/venv/bin/python3" "$install_dir/venv/lib/python$python_version/site-packages/pgadmin4/setup.py" - -#================================================= -# Postgresql superuser -#================================================= -ynh_script_progression --message="Configuring Postgresql superuser..." - -ynh_psql_execute_as_root --sql "ALTER USER $app WITH SUPERUSER CREATEDB CREATEROLE REPLICATION" - -# Add Server In PGadmin database -# ynh_add_config --template="setup_database.py" --destination "$install_dir/setup_database.py" -# chmod +x "$install_dir/setup_database.py" -# "$install_dir/venv/bin/python3" "$install_dir/setup_database.py" "$db_user" "$db_pwd" +ynh_exec_as "$app" "$install_dir/setup.exp" "$install_dir/venv/bin/python3" "$install_dir/venv/lib/python$python_version/site-packages/pgadmin4/setup.py" ynh_add_config --template="server.json" --destination="$install_dir/server.json" -"$install_dir/venv/bin/python3" "$install_dir/venv/lib/python$python_version/site-packages/pgadmin4/setup.py" --user "$email" --load-servers "$install_dir/server.json" +ynh_exec_as "$app" "$install_dir/venv/bin/python3" "$install_dir/venv/lib/python$python_version/site-packages/pgadmin4/setup.py" --user "$email" --load-servers "$install_dir/server.json" # Set permission after initialisation ynh_script_progression --message="Protecting directory"