mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
Merge branch 'dittoapp-opts' into 'main'
DittoApp: combine opts and vars into one object See merge request soapbox-pub/ditto!690
This commit is contained in:
commit
7256b5dcf8
2 changed files with 5 additions and 5 deletions
|
|
@ -214,7 +214,7 @@ if (conf.cronEnabled) {
|
|||
cron({ conf, db, relay });
|
||||
}
|
||||
|
||||
const app = new DittoApp({ conf, db, relay }, { strict: false });
|
||||
const app = new DittoApp({ conf, db, relay, strict: false });
|
||||
|
||||
/** User-provided files in the gitignored `public/` directory. */
|
||||
const publicFiles = serveStatic({ root: './public/' });
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@ export class DittoApp extends Hono<DittoEnv> {
|
|||
// @ts-ignore Require a DittoRoute for type safety.
|
||||
declare route: (path: string, app: Hono<DittoEnv>) => Hono<DittoEnv>;
|
||||
|
||||
constructor(vars: Omit<DittoEnv['Variables'], 'signal'>, opts: HonoOptions<DittoEnv> = {}) {
|
||||
constructor(opts: Omit<DittoEnv['Variables'], 'signal'> & HonoOptions<DittoEnv>) {
|
||||
super(opts);
|
||||
|
||||
this.use((c, next) => {
|
||||
c.set('db', vars.db);
|
||||
c.set('conf', vars.conf);
|
||||
c.set('relay', vars.relay);
|
||||
c.set('db', opts.db);
|
||||
c.set('conf', opts.conf);
|
||||
c.set('relay', opts.relay);
|
||||
c.set('signal', c.req.raw.signal);
|
||||
return next();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue