Skip to content

Commit

Permalink
Update config for direnv (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakewheeler authored Sep 25, 2024
1 parent 1d55fb5 commit 02761e5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ DB_USER=postgres
DB_HOST=localhost
DB_PORT=5432
DB_NAME=phinvads
DB_PASSWORD=phinvads

HOST=localhost
PORT=4000
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dotenv
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

PHIN VADS written in Go. Load `phinvads.dump` into a PostgreSQL database using `pg_restore`, run the app with [air](https://github.com/air-verse/air), and go!

### Dev setup
## Dev setup

1. Clone this repo:

Expand Down Expand Up @@ -31,6 +31,12 @@ PHIN VADS written in Go. Load `phinvads.dump` into a PostgreSQL database using `
go install github.com/air-verse/air@latest
```

1. Install [templ](https://github.com/a-h/templ)

```bash
go install github.com/a-h/templ/cmd/templ@latest
```

1. Install [mkcert](https://github.com/FiloSottile/mkcert)
1. Create your own self-signed certs for local development:

Expand Down
3 changes: 2 additions & 1 deletion internal/config/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ func init() {

func LoadConfig() *Config {
dbUser := os.Getenv("DB_USER")
dbPassword := os.Getenv("DB_PASSWORD")
dbHost := os.Getenv("DB_HOST")
dbPort := os.Getenv("DB_PORT")
dbName := os.Getenv("DB_NAME")
dbString := fmt.Sprintf(`postgresql://%s@%s:%s/%s`, dbUser, dbHost, dbPort, dbName)
dbString := fmt.Sprintf(`postgresql://%s:%s@%s:%s/%s`, dbUser, dbPassword, dbHost, dbPort, dbName)

host := os.Getenv("HOST")
port := os.Getenv("PORT")
Expand Down

0 comments on commit 02761e5

Please sign in to comment.