Skip to content

Commit

Permalink
fix: local development environment (#68)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz authored Jan 2, 2025
1 parent 43df142 commit 3db575b
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 154 deletions.
4 changes: 3 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DATABASE_URL=postgres://user:password@localhost:5432/nwc-periodic-payments
DATABASE_URL=postgres://user:password@localhost:5442/nwc-periodic-payments

# default email config will use Mailhog
EMAIL_SERVER_USER=username
Expand All @@ -8,7 +8,9 @@ EMAIL_SERVER_PORT=1025
EMAIL_FROM=[email protected]

INNGEST_EVENT_KEY="local"
INNGEST_DEV=1
INNGEST_SIGNING_KEY=
INNGEST_SERVE_HOST=http://localhost:8081

ORIGIN=http://localhost:8081

Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
database:
image: "postgres:latest"
ports:
- 5432:5432
- 5442:5432
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
"format:fix": "yarn prettier --write . --check '!.db'",
"format:check": "yarn prettier --check . --check '!.db'",
"inngest:local": "inngest-cli dev",
"docker:start": "docker-compose up",
"docker:stop": "docker-compose stop",
"docker:remove": "docker-compose down",
"docker:start": "docker compose up",
"docker:stop": "docker compose stop",
"docker:remove": "docker compose down",
"db:migrate:local": "dotenv -e .env.local -- prisma migrate dev",
"db:migrate:local:createonly": "dotenv -e .env.local -- prisma migrate dev --create-only",
"db:connect:local": "psql postgres://user:password@localhost:5432/nwc-periodic-payments",
"db:connect:local": "psql postgres://user:password@localhost:5442/nwc-periodic-payments",
"db:connect:fly": "flyctl postgres connect -a nwc-periodic-payments-db -d nwc_periodic_payments",
"db:studio:local": "dotenv -e .env.local -- prisma studio",
"db:reset:local": "dotenv -e .env.local -- prisma migrate reset",
Expand Down Expand Up @@ -62,7 +62,7 @@
"@types/nodemailer": "^6.4.10",
"dotenv-cli": "^7.3.0",
"husky": "^8.0.0",
"inngest-cli": "^0.11.0",
"inngest-cli": "^1.3.3",
"prettier": "^3.0.3"
}
}
7 changes: 5 additions & 2 deletions pages/api/inngest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import { isError } from "lib/utils";
import { add } from "date-fns";
import ms from "ms";

global.crypto = crypto;
if (!global.crypto) {
global.crypto = crypto;
}

type PeriodicZapEvent = {
name: "zap";
Expand Down Expand Up @@ -288,6 +290,7 @@ const periodicZap = inngest.createFunction(
);

export default serve(inngest, [periodicZap], {
serveHost: "https://nwc-periodic-payments.fly.dev",
serveHost:
process.env.INNGEST_SERVE_HOST || "https://nwc-periodic-payments.fly.dev",
servePath: "/api/inngest",
});
Loading

0 comments on commit 3db575b

Please sign in to comment.