-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
170 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/ | ||
|
||
name: Fly Deploy | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
deploy: | ||
name: Deploy app | ||
runs-on: ubuntu-latest | ||
concurrency: deploy-group # optional: ensure only one action runs at a time | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: superfly/flyctl-actions/setup-flyctl@master | ||
- run: flyctl deploy --remote-only | ||
env: | ||
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,43 @@ | ||
import { Hono } from "hono"; | ||
import { serveStatic } from "hono/deno"; | ||
import { secureHeaders } from "hono/secure-headers"; | ||
import { loggerMiddleware, LOG_LEVEL, logger } from "./logger.ts"; | ||
import { sentry } from "npm:@hono/sentry"; | ||
import { lnurlApp } from "./lnurlp.ts"; | ||
import { PORT } from "./constants.ts"; | ||
import { usersApp } from "./users.ts"; | ||
import { DB, runMigration } from "./db/db.ts"; | ||
import { createLnurlApp } from "./lnurlp.ts"; | ||
import { LOG_LEVEL, logger, loggerMiddleware } from "./logger.ts"; | ||
import { NWCPool } from "./nwc/nwcPool.ts"; | ||
import { createUsersApp } from "./users.ts"; | ||
|
||
await runMigration(); | ||
|
||
const db = new DB(); | ||
const nwcPool = new NWCPool(db); | ||
await nwcPool.init(); | ||
|
||
const SENTRY_DSN = Deno.env.get("SENTRY_DSN"); | ||
|
||
const baseApp = new Hono(); | ||
const hono = new Hono(); | ||
|
||
baseApp.use(loggerMiddleware()); | ||
baseApp.use(secureHeaders()); | ||
hono.use(loggerMiddleware()); | ||
hono.use(secureHeaders()); | ||
if (SENTRY_DSN) { | ||
baseApp.use("*", sentry({ dsn: SENTRY_DSN })); | ||
hono.use("*", sentry({ dsn: SENTRY_DSN })); | ||
} | ||
|
||
baseApp.route("/.well-known/lnurlp", lnurlApp); | ||
baseApp.route("/users", usersApp); | ||
hono.route("/.well-known/lnurlp", createLnurlApp(db)); | ||
hono.route("/users", createUsersApp(db, nwcPool)); | ||
|
||
baseApp.get("/ping", (c) => { | ||
hono.get("/ping", (c) => { | ||
return c.body("OK"); | ||
}); | ||
|
||
baseApp.use("/favicon.ico", serveStatic({ path: "./favicon.ico" })); | ||
hono.use("/favicon.ico", serveStatic({ path: "./favicon.ico" })); | ||
|
||
baseApp.get("/robots.txt", (c) => { | ||
hono.get("/robots.txt", (c) => { | ||
return c.body("User-agent: *\nDisallow: /", 200); | ||
}); | ||
|
||
Deno.serve({ port: PORT }, baseApp.fetch); | ||
Deno.serve({ port: PORT }, hono.fetch); | ||
|
||
logger.info("Server started", { port: PORT, log_level: LOG_LEVEL }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.