Merged in bugfix/envvars (pull request #20)

Fix SQLc Env Vars

* init

* fixenvvar

* ignoredevbox

* queueurl
This commit is contained in:
Michael McGuinness
2025-01-14 13:28:25 +00:00
parent a7ad31a3f8
commit 9f9700a773
7 changed files with 33 additions and 4 deletions
+2
View File
@@ -70,3 +70,5 @@ Thumbs.db
*.mov
*.wmv
# Devbox
.devbox/
+2
View File
@@ -2,3 +2,5 @@
extends: default
ignore: |
vendor/
.devbox/
out/
+1 -2
View File
@@ -8,9 +8,8 @@ Using the following project as a baseline: https://github.com/golang-standards/p
- Install devbox: `https://www.jetify.com/docs/devbox/installing_devbox`
- Ubuntu/MacOS: `curl -fsSL https://get.jetify.com/devbox | bash`
- Run `devbox run init` to create init dependencies
- Run `devbox shell` to enter the environment
- Create `.env` file to add environment variables
- Run `direnv allow` to ensure environment variables are populated
- Run `task deps:download` to download code dependencies
- (IF NECESSARY) Ensure user in docker group and docker group is in sudo group
```
+2 -2
View File
@@ -18,11 +18,11 @@
],
"shell": {
"init_hook": [
"DB_URI=postgres://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}?sslmode=disable",
"export DB_URI=postgres://${DB_USER}:${DB_PASS}@${DB_HOST}:${DB_PORT}/${DB_NAME}?sslmode=disable",
"echo 'Welcome to the DoczyAI devbox!'"
],
"scripts": {
"deps:download": [
"init": [
"task deps:download"
]
}
+2
View File
@@ -25,6 +25,8 @@ func TestNew(t *testing.T) {
return MockController{}
}
t.Setenv("QUEUE_URL", "example_url")
queue.NewServer(ctx, &queue.ListenerConfig{
Controller: controller,
BasePath: "../..",
+3
View File
@@ -28,6 +28,9 @@ includes:
taskfile: database.yml
tasks:
init:
cmds:
- touch .env
fullsuite:
deps:
- lint
+21
View File
@@ -8,6 +8,12 @@ sql:
engine: "postgresql"
queries: "database/queries/"
schema: "database/migrations"
rules:
- sqlc/db-prepare
- no-delete
- no-pg
- no-seq-scan
- too-costly
database:
managed: true
gen:
@@ -15,3 +21,18 @@ sql:
package: "repository"
out: "internal/database/repository"
sql_package: "pgx/v5"
rules:
- name: no-pg
message: "invalid engine: not postgresql"
rule: |
config.engine != "postgresql"
- name: no-delete
message: "don't use delete statements"
rule: |
query.sql.contains("DELETE")
- name: too-costly
message: "Query cost estimate is too high"
rule: "postgresql.explain.plan.total_cost > 400.0"
- name: no-seq-scan
message: "Query plan results in a sequential scan"
rule: "postgresql.explain.plan.node_type == 'Seq Scan'"