const dotenv = require('dotenv')

dotenv.config()

const requiredEnv = []

for (const key of requiredEnv) {
    if (!process.env[key]) {
        console.warn(`[config] 缺少环境变量: ${key}`)
    }
}

module.exports = {
    nodeEnv: process.env.NODE_ENV || 'development',
    port: Number(process.env.PORT || 3000),
    apiPrefix: process.env.API_PREFIX || '/api',
    appProtocol: process.env.APP_PROTOCOL || 'http',
    appDomain: process.env.APP_DOMAIN || 'localhost',
    appBaseUrl:
        process.env.APP_BASE_URL
        || `${process.env.APP_PROTOCOL || 'http'}://${process.env.APP_DOMAIN || 'localhost'}${process.env.PORT ? `:${process.env.PORT}` : ''}`,
    pocketbaseUrl: process.env.POCKETBASE_API_URL || '',
    pocketbaseAuthToken: process.env.POCKETBASE_AUTH_TOKEN || '',
}
