the statusphere demo reworked into a vite/react app in a monorepo
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add DB_PATH env var

+10 -5
+1
.env.template
··· 3 3 PORT="8080" # The port your server will listen on 4 4 HOST="localhost" # Hostname for the server 5 5 PUBLIC_URL="" # Set when deployed publicly, e.g. "https://mysite.com". Informs OAuth client id. 6 + DB_PATH=":memory:" # The SQLite database path. Leave as ":memory:" to use a temporary in-memory database. 6 7 7 8 # CORS Settings 8 9 CORS_ORIGIN="http://localhost:*" # Allowed CORS origin, adjust as necessary
+5 -1
src/env.ts
··· 4 4 dotenv.config() 5 5 6 6 export const env = cleanEnv(process.env, { 7 - NODE_ENV: str({ devDefault: testOnly('test'), choices: ['development', 'production', 'test'] }), 7 + NODE_ENV: str({ 8 + devDefault: testOnly('test'), 9 + choices: ['development', 'production', 'test'], 10 + }), 8 11 HOST: host({ devDefault: testOnly('localhost') }), 9 12 PORT: port({ devDefault: testOnly(3000) }), 10 13 PUBLIC_URL: str({}), 14 + DB_PATH: str({ devDefault: ':memory:' }), 11 15 COOKIE_SECRET: str({ devDefault: '00000000000000000000000000000000' }), 12 16 CORS_ORIGIN: str({ devDefault: testOnly('http://localhost:3000') }), 13 17 COMMON_RATE_LIMIT_MAX_REQUESTS: num({ devDefault: testOnly(1000) }),
+4 -4
src/server.ts
··· 18 18 constructor( 19 19 public app: express.Application, 20 20 public server: http.Server, 21 - public ctx: AppContext, 21 + public ctx: AppContext 22 22 ) {} 23 23 24 24 static async create() { 25 - const { NODE_ENV, HOST, PORT } = env 25 + const { NODE_ENV, HOST, PORT, DB_PATH } = env 26 26 27 27 const logger = pino({ name: 'server start' }) 28 - const db = createDb(':memory:') 28 + const db = createDb(DB_PATH) 29 29 await migrateToLatest(db) 30 30 const ingester = new Ingester(db) 31 31 const oauthClient = await createClient(db) ··· 57 57 formAction: null, 58 58 }, 59 59 }, 60 - }), 60 + }) 61 61 ) 62 62 63 63 // Request logging