Commit c5806a98 authored by nanahira's avatar nanahira

use env for configuration

parent 3159b2b6
...@@ -105,6 +105,7 @@ dist ...@@ -105,6 +105,7 @@ dist
/build /build
/output /output
/test
.git* .git*
.dockerignore .dockerignore
......
FROM node:buster-slim FROM node:buster-slim
RUN apt update && apt -y install python3 build-essential && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* RUN apt update && apt -y install python3 build-essential sqlite3 && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
WORKDIR /usr/src/app WORKDIR /usr/src/app
COPY ./package*.json ./ COPY ./package*.json ./
RUN npm ci RUN npm ci
......
...@@ -9,5 +9,11 @@ export interface Config { ...@@ -9,5 +9,11 @@ export interface Config {
} }
export async function loadConfig(): Promise<Config> { export async function loadConfig(): Promise<Config> {
return yaml.parse(await fs.promises.readFile("./config.yaml", "utf-8")); // return yaml.parse(await fs.promises.readFile("./config.yaml", "utf-8"));
return {
postDepth: process.env.POST_DEPTH ? parseInt(process.env.POST_DEPTH) : 5,
jpDatabasePath: process.env.JP_DATABASE_PATH || "./ygopro-database/locales/ja-JP/cards.cdb",
cnDatabasePath: process.env.CN_DATABASE_PATH || "./ygopro-database/locales/zh-CN/cards.cdb",
outputPath: process.env.OUTPUT_PATH || "./output"
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment