brf/server/config/site.ts

57 lines
1.0 KiB
TypeScript

import _ from 'lodash'
import env from '../env.ts'
const domain = 'brf.lkm.nu'
type SiteConfig = {
title: string
name: string
port: string | null
hostname: string | null
domain: string
protocol: string
localHost: string
host: string | null
url: string
emails: Record<string, string>
}
const defaults: SiteConfig = {
title: 'BRF',
name: 'brf',
port: null,
hostname: null,
domain,
protocol: 'http',
localHost: `http://localhost:${env.PORT}`,
get host() {
return this.port ? `${this.hostname}:${this.port}` : this.hostname
},
get url() {
return `${this.protocol}://${this.host}/`
},
emails: {
robot: `no-reply@bitmill.io`,
info: 'contact@bitmill.io',
},
}
export default _.merge(
defaults,
{
development: {
hostname: 'localhost',
port: env.PORT,
},
production: {
hostname: domain,
protocol: 'https',
emails: {
robot: `no-reply@${domain}`,
info: `info@${domain}`,
},
},
}[env.NODE_ENV as 'development' | 'production'],
) as SiteConfig