Merge branch 'main' into fix-issue-51

This commit is contained in:
wancat committed 2024-02-08 17:48:11 +08:00
commit ca2a40341c
72 files changed
+11372 -7146

No files matched your search

+6 -1
View File
@@ -1,6 +1,10 @@
import validator from 'validator'
import dotenv from 'dotenv'
import { get } from './utils/env.js'
// Import dotenv and load ../.env
dotenv.config({ path: '../.env' })
function getTrustProxies(key) {
if (!process.env[key]) {
return []
@@ -40,7 +44,7 @@ const config = {
bugReportUrl: getUrl('BUG_REPORT_URL', ''),
docker: {
network: get('DOCKER_NETWORK', 'linux-odyssey-players'),
network: get('DOCKER_NETWORK', 'host'),
defaultImage: get('QUEST_IMAGE', 'linuxodyssey/quest-base'),
imagePrefix: get('DOCKER_PREFIX', 'linuxodyssey/quest-'),
mountQuest: get('MOUNT_QUEST', ''),
@@ -53,6 +57,7 @@ const config = {
}
config.baseUrl = get('BASE_URL', `http://${config.host}:${config.port}`)
config.backendUrl = get('BACKEND_URL', config.baseUrl)
config.testing = {
enabled: !config.isProduction && process.env.TESTING === 'true',
username: get('TESTING_USERNAME', ''),
+1 -3
View File
@@ -16,8 +16,6 @@ const containerOptions = {
},
}
// const network = engine.getNetwork(config.dockerNetwork)
export function createContainer(name, questId) {
const option = {
...containerOptions,
@@ -56,7 +54,7 @@ export async function attachContainer(container, { token }) {
Tty: true,
Env: [
`TOKEN=${token}`,
`API_ENDPOINT=http://backend:3000`,
`API_ENDPOINT=${config.backendUrl}`,
'ZDOTDIR=/etc/zsh',
],
})
-2
View File
@@ -41,7 +41,6 @@ async function loadGlobalExceptions() {
export async function loadAndUpdateQuests() {
await Quest.deleteMany({})
const { exceptions } = await loadGlobalExceptions()
console.log(exceptions)
return mapQuests(async (id, questPath) => {
const files = await fs.readdir(questPath)
if (!files.includes('game.yml')) {
@@ -64,7 +63,6 @@ export async function loadAndUpdateQuests() {
quest.exceptions.push(...exceptions)
await quest.save()
} catch (error) {
console.error(error)
logger.error(`Error parsing quest`, { id, error })
throw new QuestValidationError(`Error parsing quest`, id, error)
}