Workflow takes folder path into consideration when e.g. enabling LLMs etc.
mkdir -p ~/code/public
mkdir -p ~/code/work/public
mkdir -p ~/code/work/private
Use brew
to define any global tooling.
Use pkgx
to define project tooling (see dev
command).
In each project, add a pkgx.yml
file to define project tooling, unless it is
not picked up from lockfiles etc.
Note that the shell integration is required and that the dev
command must be
used to activate the dev tooling. See more info in the docs:
docs.pkgx.sh
# pkgx.yml
dependencies:
- go # uses the latest version if no version is specified
- [email protected]
Use direnv to set environment variables dynamically when entering a folder.
Add .envrc
files in strategic locations, like:
~/code/work/.envrc
~/code/work/project/.envrc
Run direnv allow .
in each location to allow it to execute.
Start the project's .envrc
file with:
source_up_if_exists
Add default (personal) and work configs, something like this (replace work
with actual company name):
gcloud config configurations list
# personal
gcloud config configurations create default
gcloud config configurations activate default
cat ~/.config/gcloud/configurations/config_default # review
# work
gcloud config configurations list
gcloud config configurations create work
gcloud config configurations activate work
cat ~/.config/gcloud/configurations/config_work # review
# set active by default
gcloud config set account [email protected]
The configs should look something like this:
[core]
disable_usage_reporting = False
account = [email protected]
Then use .envrc
file in ~/code/work/.envrc
to automatically switch from
default/personal account to work account:
export CLOUDSDK_ACTIVE_CONFIG_NAME="work"
Add as needed to .envrc
, per project or in a top-level work folder, or a mix:
export CLOUDSDK_ACTIVE_CONFIG_NAME="name-of-config"
export CLOUDSDK_CORE_PROJECT="name-of-gcp-project"
export CLOUDSDK_COMPUTE_REGION="europe-west1"
export CLOUDSDK_COMPUTE_ZONE="europe-west1-b"
Add something like this so to enable cloud-sql-proxy $DB1
:
export DB1="$CLOUDSDK_CORE_PROJECT:$CLOUDSDK_COMPUTE_REGION:$GCE_DATABASE_INSTANCE_1"
Add something like this to enable psql --expanded $PGCONN -f query.sql
:
export PGDRIVER="postgresql://"
export PGHOST="127.0.0.1"
export PGPORT="5432"
export GCE_DATABASE_NAME="db"
export DB_USER="postgres"
export DB_PASS="secret"
export PGFLAGS="?sslmode=disable"
export PGCONN="$PGDRIVER$DB_USER:$DB_USER@$PGHOST:$PGPORT/$GCE_DATABASE_NAME$PGFLAGS"