mirror of
https://github.com/dbgate/dbgate
synced 2024-11-23 00:43:10 +00:00
renamed dbgate-data to .dbgate #248
This commit is contained in:
parent
eeb52b9a41
commit
ce4124caef
@ -32,15 +32,6 @@ try {
|
||||
initialConfig = {};
|
||||
}
|
||||
|
||||
// let settingsJson = {};
|
||||
// try {
|
||||
// const datadir = path.join(os.homedir(), 'dbgate-data');
|
||||
// settingsJson = JSON.parse(fs.readFileSync(path.join(datadir, 'settings.json'), { encoding: 'utf-8' }));
|
||||
// } catch (err) {
|
||||
// console.log('Error loading settings.json:', err.message);
|
||||
// settingsJson = {};
|
||||
// }
|
||||
|
||||
// Keep a global reference of the window object, if you don't, the window will
|
||||
// be closed automatically when the JavaScript object is garbage collected.
|
||||
let mainWindow;
|
||||
@ -252,7 +243,7 @@ function fillMissingSettings(value) {
|
||||
function createWindow() {
|
||||
let settingsJson = {};
|
||||
try {
|
||||
const datadir = path.join(os.homedir(), 'dbgate-data');
|
||||
const datadir = path.join(os.homedir(), '.dbgate');
|
||||
settingsJson = fillMissingSettings(
|
||||
JSON.parse(fs.readFileSync(path.join(datadir, 'settings.json'), { encoding: 'utf-8' }))
|
||||
);
|
||||
|
@ -14,7 +14,7 @@ services:
|
||||
# - /home/jena/dbgate-data:/root/dbgate-data
|
||||
|
||||
volumes:
|
||||
- dbgate-data:/root/dbgate-data
|
||||
- dbgate-data:/root/.dbgate
|
||||
|
||||
# environment:
|
||||
# WEB_ROOT: /dbgate
|
||||
|
@ -13,6 +13,6 @@ RUN ["chmod", "+x", "/home/dbgate-docker/entrypoint.sh"]
|
||||
|
||||
WORKDIR /home/dbgate-docker
|
||||
EXPOSE 3000
|
||||
VOLUME /root/dbgate-data
|
||||
VOLUME /root/.dbgate
|
||||
|
||||
CMD ["/home/dbgate-docker/entrypoint.sh"]
|
||||
|
@ -12,6 +12,6 @@ RUN ["chmod", "+x", "/home/dbgate-docker/entrypoint.sh"]
|
||||
|
||||
WORKDIR /home/dbgate-docker
|
||||
EXPOSE 3000
|
||||
VOLUME /root/dbgate-data
|
||||
VOLUME /root/.dbgate
|
||||
|
||||
CMD ["/home/dbgate-docker/entrypoint.sh"]
|
||||
|
2
packages/api/env/portal/.env
vendored
2
packages/api/env/portal/.env
vendored
@ -38,7 +38,7 @@ SSH_LOGIN_mysqlssh=root
|
||||
SSH_PASSWORD_mysqlssh=xxx
|
||||
|
||||
LABEL_sqlite=sqlite
|
||||
FILE_sqlite=/home/jena/dbgate-data/files/sqlite/feeds.sqlite
|
||||
FILE_sqlite=/home/jena/.dbgate/files/sqlite/feeds.sqlite
|
||||
ENGINE_sqlite=sqlite@dbgate-plugin-sqlite
|
||||
|
||||
# docker run -p 3000:3000 -e CONNECTIONS=mongo -e URL_mongo=mongodb://localhost:27017 -e ENGINE_mongo=mongo@dbgate-plugin-mongo -e LABEL_mongo=mongo dbgate/dbgate:beta
|
||||
|
@ -4,6 +4,7 @@ const fs = require('fs');
|
||||
const cleanDirectory = require('./cleanDirectory');
|
||||
const platformInfo = require('./platformInfo');
|
||||
const processArgs = require('./processArgs');
|
||||
const consoleObjectWriter = require('../shell/consoleObjectWriter');
|
||||
|
||||
const createDirectories = {};
|
||||
const ensureDirectory = (dir, clean) => {
|
||||
@ -27,7 +28,7 @@ function datadirCore() {
|
||||
if (processArgs.workspaceDir) {
|
||||
return processArgs.workspaceDir;
|
||||
}
|
||||
return path.join(os.homedir(), 'dbgate-data');
|
||||
return path.join(os.homedir(), '.dbgate');
|
||||
}
|
||||
|
||||
function datadir() {
|
||||
@ -112,6 +113,27 @@ function clearArchiveLinksCache() {
|
||||
archiveLinksCache = {};
|
||||
}
|
||||
|
||||
function migrateDataDir() {
|
||||
if (process.env.WORKSPACE_DIR) {
|
||||
return;
|
||||
}
|
||||
if (processArgs.workspaceDir) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const oldDir = path.join(os.homedir(), 'dbgate-data');
|
||||
const newDir = path.join(os.homedir(), '.dbgate');
|
||||
if (fs.existsSync(oldDir) && !fs.existsSync(newDir)) {
|
||||
fs.renameSync(oldDir, newDir);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('Error migrating data dir:', e.message);
|
||||
}
|
||||
}
|
||||
|
||||
migrateDataDir();
|
||||
|
||||
module.exports = {
|
||||
datadir,
|
||||
jsldir,
|
||||
|
Loading…
Reference in New Issue
Block a user