aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Bex <peter@more-magic.net>2023-03-19 10:50:55 +0100
committerPeter Bex <peter@more-magic.net>2023-03-19 10:50:55 +0100
commit4dc7e35e7aa542243c9beed5c6a2a5fc07836de9 (patch)
treef67968cfee99942a8f77770ab83756a9d417ff24
parent9d05c9ca73c2b501744d528475532ab728318bde (diff)
downloadppq-4dc7e35e7aa542243c9beed5c6a2a5fc07836de9.tar.gz
Add ability to customize envrc settings via .envr.localHEADmaster
This allows, for example, to easily run a different major Postgres version.
-rw-r--r--.envrc2
-rw-r--r--.gitignore4
-rw-r--r--README24
3 files changed, 28 insertions, 2 deletions
diff --git a/.envrc b/.envrc
index 015c979..6b47d35 100644
--- a/.envrc
+++ b/.envrc
@@ -3,6 +3,8 @@ export PPQ_POSTGRES_VERSION=15
export PPQ_POSTGRES_DIR=$(expand_path postgres)
export PPQ_POSTGRES_DATA_DIR=$(expand_path postgres/data)
+source_env_if_exists .envrc.local
+
# Settings for libpq-based clients and postgres itself
export PGDATA="${PPQ_POSTGRES_DATA_DIR}"
export PGHOST="${PPQ_POSTGRES_DATA_DIR}"
diff --git a/.gitignore b/.gitignore
index fc2d52a..b71afcc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
+.envrc.local
postgres/data
-postgres/postgresql_overrides.conf \ No newline at end of file
+postgres/postgresql_overrides.conf
+postgres/prepare.sql \ No newline at end of file
diff --git a/README b/README
index a4aa7c0..379b245 100644
--- a/README
+++ b/README
@@ -19,4 +19,26 @@ Then you can run a Postgres server with `./ppq start`.
All Postgres client programs (like `psql`, `pg_restore` etc) are
available and environment variables like `PGUSER` and `PGHOST` are set
-up to ensure it will talk to the local Postgres server automatically. \ No newline at end of file
+up to ensure it will talk to the local Postgres server automatically.
+
+
+Customizing the project
+-----------------------
+
+The `.envrc` file loads a `.envrc.local` if it exists. Here, you can
+override any environment variables you want. The following environment
+variables can be overridden:
+
+ PPQ_POSTGRES_VERSION - the major Postgres version to use
+ PPQ_POSTGRES_DIR - The *absolute path* to the directory that holds that data dir
+ PPQ_POSTGRES_DATA_DIR - The *absolute path* to the PostgreSQL data directory
+
+Note that you can use direnv's expand_path function to make a relative
+path absolute.
+
+The `ppq.sh` script will also execute `${PPQ_POSTGRES_DIR}/prepare.sql`
+when preparing the database via initdb.
+
+If you want to add `postgresql.conf` settings, you can create a file
+called `${PPQ_POSTGRES_DIR}/postgresql_overrides.conf` and it will be
+loaded by `postgresql.conf`. \ No newline at end of file