Ship signup sheet, subscribe reminders, cover crop, and theme updates.
Wire real WeChat app config, prefer activity cover over posters, and add admin cover cropping for the home banner. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,3 +1,31 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
// Load local secrets from server/.env (gitignored). Never commit this file.
|
||||
function loadEnv() {
|
||||
const file = path.join(__dirname, '.env')
|
||||
if (!fs.existsSync(file)) return
|
||||
fs.readFileSync(file, 'utf8')
|
||||
.split('\n')
|
||||
.forEach((line) => {
|
||||
const text = line.trim()
|
||||
if (!text || text.startsWith('#')) return
|
||||
const i = text.indexOf('=')
|
||||
if (i < 1) return
|
||||
const key = text.slice(0, i).trim()
|
||||
let value = text.slice(i + 1).trim()
|
||||
if (
|
||||
(value.startsWith('"') && value.endsWith('"')) ||
|
||||
(value.startsWith("'") && value.endsWith("'"))
|
||||
) {
|
||||
value = value.slice(1, -1)
|
||||
}
|
||||
if (!process.env[key]) process.env[key] = value
|
||||
})
|
||||
}
|
||||
|
||||
loadEnv()
|
||||
|
||||
const app = require('./app')
|
||||
const db = require('./lib/db')
|
||||
|
||||
@@ -10,5 +38,7 @@ app.listen(PORT, () => {
|
||||
console.log(`管理后台 http://localhost:${PORT}/admin`)
|
||||
if (!process.env.WX_APPID || !process.env.WX_SECRET) {
|
||||
console.log('未配置 WX_APPID / WX_SECRET,小程序登录走演示模式')
|
||||
} else {
|
||||
console.log(`微信登录已启用 AppID ${process.env.WX_APPID}`)
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user