this repo has no description
0
fork

Configure Feed

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

at main 39 lines 1.1 kB view raw
1import dotenv from 'dotenv' 2import FeedGenerator from './server' 3import { AddressInfo } from 'net' 4 5const run = async () => { 6 dotenv.config() 7 const hostname = maybeStr(process.env.FEEDGEN_HOSTNAME) ?? 'localhost' 8 const serviceDid = 9 maybeStr(process.env.FEEDGEN_SERVICE_DID) ?? `did:web:${hostname}` 10 const server = FeedGenerator.create({ 11 port: maybeInt(process.env.FEEDGEN_PORT) ?? 3000, 12 postgresConnectionString: process.env.DATABASE_URL!, 13 subscriptionEndpoint: 14 maybeStr(process.env.FEEDGEN_SUBSCRIPTION_ENDPOINT) ?? 15 'wss://bsky.social', 16 hostname, 17 serviceDid, 18 }) 19 await server.start() 20 console.log( 21 `🤖 running feed generator at http://${server.cfg.hostname}:${ 22 server.cfg.port 23 }, bound to ${(server.server?.address() as AddressInfo).address}`, 24 ) 25} 26 27const maybeStr = (val?: string) => { 28 if (!val) return undefined 29 return val 30} 31 32const maybeInt = (val?: string) => { 33 if (!val) return undefined 34 const int = parseInt(val, 10) 35 if (isNaN(int)) return undefined 36 return int 37} 38 39run()