Fixed env mappings...
This commit is contained in:
parent
c65845b528
commit
6ddc4a771d
|
@ -21,8 +21,8 @@ export function dbInit() {
|
|||
log("Starting up databases...")
|
||||
|
||||
/* load in db using better-sqlite3 */
|
||||
sqlite = new Database(process.env.DDNET_SQLITE_PATH ?? 'data/ddnet.sqlite', { });
|
||||
skinDB = new Database(process.env.DDNSS_SQLITE_PATH ?? 'data/skindata.sqlite', { });
|
||||
sqlite = new Database(process.env.DATA_DIR ? `${process.env.DATA_DIR}/ddnet.sqlite` : 'data/ddnet.sqlite', { });
|
||||
skinDB = new Database(process.env.DATA_DIR ? `${process.env.DATA_DIR}/skindata.sqlite` : 'data/skindata.sqlite', { });
|
||||
|
||||
/* WAL mode */
|
||||
sqlite.pragma('journal_mode = WAL');
|
||||
|
|
|
@ -60,14 +60,14 @@ export function downloadEssentialData() {
|
|||
(resolve, reject) => {
|
||||
log("Downloading 'ddnet.sqlite.zip' and 'players.msgpack'...")
|
||||
Promise.all([
|
||||
download("https://ddnet.tw/stats/ddnet.sqlite.zip", process.env.DDNET_SQLITE_PATH ? `${process.env.DDNET_SQLITE_PATH}.zip` : 'data/ddnet.sqlite.zip'),
|
||||
download("https://ddnet.tw/players.msgpack", process.env.MSGPACK_PATH ?? 'data/players.msgpack')
|
||||
download("https://ddnet.tw/stats/ddnet.sqlite.zip", process.env.DATA_DIR ? `${process.env.DATA_DIR}/ddnet.sqlite.zip` : 'data/ddnet.sqlite.zip'),
|
||||
download("https://ddnet.tw/players.msgpack", process.env.DATA_DIR ? `${process.env.DATA_DIR}/players.msgpack` : 'data/players.msgpack')
|
||||
]).then(() => {
|
||||
log("All downloads done! Going to unzip 'ddnet.sqlite.zip'...")
|
||||
|
||||
exec(
|
||||
`unzip -o ${process.env.DDNET_SQLITE_PATH ? `${process.env.DDNET_SQLITE_PATH}.zip` : 'data/ddnet.sqlite.zip'} \
|
||||
-d ${process.env.DDNET_SQLITE_PATH ? process.env.DDNET_SQLITE_PATH.replace(/\/[\s\S]*\.sqlite/, "") : 'data'}`,
|
||||
`unzip -o ${process.env.DATA_DIR ? `${process.env.DATA_DIR}/ddnet.sqlite.zip` : 'data/ddnet.sqlite.zip'} \
|
||||
-d ${process.env.DATA_DIR ? process.env.DATA_DIR : 'data'}`,
|
||||
err => {
|
||||
if (err) {
|
||||
log("Error while unzipping!")
|
||||
|
|
Loading…
Reference in New Issue
Block a user