1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pgadmin_ynh.git synced 2024-09-03 19:56:38 +02:00

fix server.json, cleanup

This commit is contained in:
Félix Piédallu 2024-01-31 14:38:11 +01:00
parent 5f46b9788b
commit e9907e2263
2 changed files with 17 additions and 28 deletions

View file

@ -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
}
}
}
}

View file

@ -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"