Skip to content

Commit

Permalink
feat(risedev): dump psql environment variables according to cluster c…
Browse files Browse the repository at this point in the history
…onfig (#15294)
  • Loading branch information
kwannoel authored Feb 29, 2024
1 parent ac86d9c commit c079294
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,25 @@ if [ ! -f "${RC_ENV_FILE}" ]; then
fi
'''

[tasks.psql-env]
category = "RiseDev - Start/Stop"
description = "Dump env configuration for psql"
dependencies = ["check-risedev-env-file"]
env_files = ["${PREFIX_CONFIG}/risedev-env"]
script = '''
#!/usr/bin/env bash
cat <<EOF > "${PREFIX_CONFIG}/psql-env"
export PGHOST=$RW_FRONTEND_LISTEN_ADDRESS
export PGPORT=$RW_FRONTEND_PORT
export PGUSER=root
export PGDATABASE=dev
EOF
echo "psql environment file is created at ${PREFIX_CONFIG}/psql-env"
echo "You can source this file to use psql with default connection parameters."
echo " $(tput setaf 4)source ${PREFIX_CONFIG}/psql-env$(tput sgr0)"
'''

[tasks.psql]
category = "RiseDev - Start/Stop"
description = "Run local psql client with default connection parameters. You can pass extra arguments to psql."
Expand Down

0 comments on commit c079294

Please sign in to comment.