Merged in bugfix/direnvinstall (pull request #19)

Enable environment variables

* installscript

* vars

* uninstalldirenv
This commit is contained in:
Michael McGuinness
2025-01-13 18:33:20 +00:00
parent 8c254db2ce
commit a7ad31a3f8
3 changed files with 11 additions and 81 deletions
-30
View File
@@ -1,30 +0,0 @@
#!/bin/bash
# Automatically sets up your devbox environment whenever you cd into this
# directory via our direnv integration:
eval "$(devbox generate direnv --print-envrc)"
# check out https://www.jetpack.io/devbox/docs/ide_configuration/direnv/
# for more details
export APP_ENV="${APP_ENV:-development}"
export DB_USER="${DB_USER:-postgres}"
export DB_PASS="${DB_PASS:-pass}"
export DB_HOST="${DB_HOST:-localhost}"
export DB_PORT="${DB_PORT:-5432}"
export DB_NAME="${DB_NAME:-query_orchestration}"
export DB_URI="${DB_URI:-"postgres://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}?sslmode=disable"}"
dotenv_if_exists .env
env_vars_required APP_ENV
env_vars_required QUEUE_URL
env_vars_required DB_USER DB_PASS DB_HOST DB_PORT DB_NAME
ALLOWED_ENVS=("development","production")
if [[ ! $ALLOWED_ENVS[@] =~ $APP_ENV ]]; then
echo APP_ENV invalid
exit 1
fi
+11 -3
View File
@@ -5,7 +5,6 @@
"protolint@0.50.5",
"yamllint@1.35.1",
"sqlc@1.27.0",
"direnv@2.35.0",
"go-mockery@2.46.3",
"protoc-gen-go@1.35.1",
"protoc-gen-go-grpc@1.3.0",
@@ -19,7 +18,7 @@
],
"shell": {
"init_hook": [
"eval \"$(direnv hook bash)\"",
"DB_URI=postgres://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}?sslmode=disable",
"echo 'Welcome to the DoczyAI devbox!'"
],
"scripts": {
@@ -27,5 +26,14 @@
"task deps:download"
]
}
}
},
"env": {
"APP_ENV": "development",
"DB_USER": "postgres",
"DB_PASS": "pass",
"DB_HOST": "localhost",
"DB_PORT": "5432",
"DB_NAME": "query_orchestration"
},
"env_from": ".env"
}
-48
View File
@@ -1,54 +1,6 @@
{
"lockfile_version": "1",
"packages": {
"direnv@2.35.0": {
"last_modified": "2024-12-23T21:10:33Z",
"resolved": "github:NixOS/nixpkgs/de1864217bfa9b5845f465e771e0ecb48b30e02d#direnv",
"source": "devbox-search",
"version": "2.35.0",
"systems": {
"aarch64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/xp28bzq6qi11db7pqgfx3rc139q45489-direnv-2.35.0",
"default": true
}
],
"store_path": "/nix/store/xp28bzq6qi11db7pqgfx3rc139q45489-direnv-2.35.0"
},
"aarch64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/55vva1q4lhw2m62vvzzm2z26wfkpb430-direnv-2.35.0",
"default": true
}
],
"store_path": "/nix/store/55vva1q4lhw2m62vvzzm2z26wfkpb430-direnv-2.35.0"
},
"x86_64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/gza242ir81wafi79cfxk619n36rxqqmk-direnv-2.35.0",
"default": true
}
],
"store_path": "/nix/store/gza242ir81wafi79cfxk619n36rxqqmk-direnv-2.35.0"
},
"x86_64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/jw2ax71m8dzgs8xybginlsyw79ndyww1-direnv-2.35.0",
"default": true
}
],
"store_path": "/nix/store/jw2ax71m8dzgs8xybginlsyw79ndyww1-direnv-2.35.0"
}
}
},
"go-migrate@4.18.1": {
"last_modified": "2024-12-23T21:10:33Z",
"resolved": "github:NixOS/nixpkgs/de1864217bfa9b5845f465e771e0ecb48b30e02d#go-migrate",