From 3b1a63e752037b4295b8d12ecbd61c3cad9afae7 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@unibe.ch>
Date: Mon, 11 Mar 2024 11:38:25 +0100
Subject: [PATCH] add example profiles

---
 .../mysql_localhost_docker_13306.ini.example  | 40 +++++++++++++++++++
 .../profiles/pgsql_remote.ini.example         | 34 ++++++++++++++++
 2 files changed, 74 insertions(+)
 create mode 100644 plugins/localdump/profiles/mysql_localhost_docker_13306.ini.example
 create mode 100644 plugins/localdump/profiles/pgsql_remote.ini.example

diff --git a/plugins/localdump/profiles/mysql_localhost_docker_13306.ini.example b/plugins/localdump/profiles/mysql_localhost_docker_13306.ini.example
new file mode 100644
index 0000000..da6be6d
--- /dev/null
+++ b/plugins/localdump/profiles/mysql_localhost_docker_13306.ini.example
@@ -0,0 +1,40 @@
+# ======================================================================
+#
+# DOCKER MYSQL INSTANCE ON LOCAL EXPOSED PORT
+#
+# ======================================================================
+
+[detect]
+# ----------------------------------------------------------------------
+# what to detect
+# ----------------------------------------------------------------------
+
+# a running process that must be found
+process = 'mysqld|mariadb'
+
+# a port that must be open on a given host
+tcp = 13306
+tcp-target = localhost
+
+# process that opens a port (see netstat -tulpen) - works for local services only
+# "slirp4netns" is docker network stack
+# "rootlesskit" is docker too
+tcp-process = 'rootlesskit'
+
+
+[set]
+# ----------------------------------------------------------------------
+# data to apply if it was found
+# ----------------------------------------------------------------------
+
+su = ''
+dbuser = 'root'
+dbpassword = '12345678'
+
+# unschön - das ist in der Prozessliste
+params = '--port={{tcp}} --password={{dbpassword}} --user={{dbuser}} --host={{tcp-target}}'
+
+# https://dev.mysql.com/doc/refman/8.0/en/environment-variables.html
+env = ''
+
+# ----------------------------------------------------------------------
diff --git a/plugins/localdump/profiles/pgsql_remote.ini.example b/plugins/localdump/profiles/pgsql_remote.ini.example
new file mode 100644
index 0000000..696d7ba
--- /dev/null
+++ b/plugins/localdump/profiles/pgsql_remote.ini.example
@@ -0,0 +1,34 @@
+# ======================================================================
+#
+# REMOTE PGSQL INSTANCE
+# untested yet
+#
+# ======================================================================
+
+[detect]
+
+process = 'postgres|postmaster'
+tcp = 5432
+tcp-target = dbserver.example.com
+tcp-process = 'postgres|postmaster'
+
+
+[set]
+
+su = ''
+dbuser = 'mydbuser'
+dbpassword = 'mypassword'
+
+params = '--host= {{tcp-target}} --port={tcp}} --username={{dbuser}}'
+env = 'PGPASSWORD={{dbpassword}}'
+
+# https://www.postgresql.org/docs/current/libpq-envars.html
+# from pgsql help:
+; Connection options:
+;   -h, --host=HOSTNAME      database server host or socket directory (default: "/var/run/postgresql")
+;   -p, --port=PORT          database server port (default: "5432")
+;   -U, --username=USERNAME  database user name (default: "postgres")
+;   -w, --no-password        never prompt for password
+;   -W, --password           force password prompt (should happen automatically)
+
+# ----------------------------------------------------------------------
-- 
GitLab