Založení složky server/data, pokud neexistuje, do které je vytvořen soubor db.json
This commit is contained in:
parent
f3af64923c
commit
89dec1c194
@ -66,7 +66,7 @@ RUN if [ -f /server/.easter-eggs.json ]; then cp /server/.easter-eggs.json ./ser
|
|||||||
|
|
||||||
# Export /data/db.json do složky /data
|
# Export /data/db.json do složky /data
|
||||||
VOLUME ["/data"]
|
VOLUME ["/data"]
|
||||||
COPY /data/db.json /data/db.json
|
COPY /server/data/db.json /data/db.json
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
|
@ -1,7 +1,17 @@
|
|||||||
import JSONdb from 'simple-json-db';
|
import JSONdb from 'simple-json-db';
|
||||||
import { StorageInterface } from "./StorageInterface";
|
import { StorageInterface } from "./StorageInterface";
|
||||||
|
import * as fs from 'fs';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
const db = new JSONdb('../data/db.json');
|
const dbPath = path.resolve(__dirname, '../../data/db.json');
|
||||||
|
const dbDir = path.dirname(dbPath);
|
||||||
|
|
||||||
|
// Zajistěte, že adresář existuje
|
||||||
|
if (!fs.existsSync(dbDir)) {
|
||||||
|
fs.mkdirSync(dbDir, { recursive: true });
|
||||||
|
}
|
||||||
|
|
||||||
|
const db = new JSONdb(dbPath);
|
||||||
/**
|
/**
|
||||||
* Implementace úložiště používající JSON soubor.
|
* Implementace úložiště používající JSON soubor.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user