mirror of
https://github.com/YunoHost-Apps/pgadmin_ynh.git
synced 2024-09-03 19:56:38 +02:00
Use json file to configure servers to pgadmin
This commit is contained in:
parent
8ea379db49
commit
b74f74013a
2 changed files with 31 additions and 3 deletions
25
conf/server.json
Normal file
25
conf/server.json
Normal file
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"Servers": {
|
||||
"1": {
|
||||
"Name": "YunoHost Server",
|
||||
"Group": "Server Group 1",
|
||||
"Host": "localhost",
|
||||
"Port": 5432,
|
||||
"Username": "__DB_USER__",
|
||||
"Role": "__DB_USER__",
|
||||
"MaintenanceDB": "postgres",
|
||||
|
||||
"SSLMode": "prefer",
|
||||
"SSLCert": "<STORAGE_DIR>/.postgresql/postgresql.crt",
|
||||
"SSLKey": "<STORAGE_DIR>/.postgresql/postgresql.key",
|
||||
|
||||
"Timeout": 10,
|
||||
|
||||
"DBRestriction": "live_db test_db",
|
||||
"PassFile": "/path/to/pgpassfile",
|
||||
"Shared": false,
|
||||
"Service": "postgresql-10",
|
||||
"PasswordExecCommand": "echo '__DB_PWD__'"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -49,9 +49,12 @@ 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_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_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" --load-servers "$install_dir/server.json"
|
||||
|
||||
# Set permission after initialisation
|
||||
ynh_script_progression --message="Protecting directory"
|
||||
|
|
Loading…
Reference in a new issue