fix setup path resolution
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "gancio",
|
"name": "gancio",
|
||||||
"version": "0.9.11",
|
"version": "0.9.12",
|
||||||
"description": "A shared agenda for local communities",
|
"description": "A shared agenda for local communities",
|
||||||
"author": "lesion",
|
"author": "lesion",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
process.env.NODE_ENV = "production"
|
process.env.NODE_ENV = "production"
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
const cwd = process.cwd()
|
||||||
|
|
||||||
|
// needed by nuxt
|
||||||
process.chdir(path.resolve(__dirname, '..'))
|
process.chdir(path.resolve(__dirname, '..'))
|
||||||
|
|
||||||
const arg = require('arg')
|
const arg = require('arg')
|
||||||
@@ -42,7 +45,7 @@ function parseArguments(rawArgs) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
config: path.resolve(args['--config'] || '/etc/gancio_config.json') ,
|
config: path.resolve(cwd, args['--config'] || '/etc/gancio_config.json') ,
|
||||||
install: args['--install'] || false,
|
install: args['--install'] || false,
|
||||||
upgrade: args['--upgrade'] || false
|
upgrade: args['--upgrade'] || false
|
||||||
};
|
};
|
||||||
@@ -86,7 +89,7 @@ async function setupQuestionnaire() {
|
|||||||
name: 'db.storage',
|
name: 'db.storage',
|
||||||
message: 'sqlite db path',
|
message: 'sqlite db path',
|
||||||
default: '/var/gancio/db.sqlite',
|
default: '/var/gancio/db.sqlite',
|
||||||
filter: p => path.resolve(p),
|
filter: p => path.resolve(cwd, p),
|
||||||
when: answers => answers.db.dialect === 'sqlite',
|
when: answers => answers.db.dialect === 'sqlite',
|
||||||
validate: db_path => db_path.length>0 && fs.existsSync(path.dirname(db_path))
|
validate: db_path => db_path.length>0 && fs.existsSync(path.dirname(db_path))
|
||||||
})
|
})
|
||||||
@@ -125,7 +128,7 @@ async function setupQuestionnaire() {
|
|||||||
try {
|
try {
|
||||||
const db = new sequelize({ ...options.db, dialect: 'postgres' , password, logging: false })
|
const db = new sequelize({ ...options.db, dialect: 'postgres' , password, logging: false })
|
||||||
return db.authenticate().then( () => {
|
return db.authenticate().then( () => {
|
||||||
consola.info(`DB connected`)
|
// consola.info(`DB connected`)
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
@@ -139,7 +142,7 @@ async function setupQuestionnaire() {
|
|||||||
name: 'upload_path',
|
name: 'upload_path',
|
||||||
message: 'Where gancio has to store media?',
|
message: 'Where gancio has to store media?',
|
||||||
default: '/var/gancio/',
|
default: '/var/gancio/',
|
||||||
filter: p => path.resolve(p),
|
filter: p => path.resolve(cwd, p),
|
||||||
validate: p => {
|
validate: p => {
|
||||||
const exists = fs.existsSync(p)
|
const exists = fs.existsSync(p)
|
||||||
if (!exists) consola.warn(`"${p}" does not exists, please create it`)
|
if (!exists) consola.warn(`"${p}" does not exists, please create it`)
|
||||||
|
|||||||
Reference in New Issue
Block a user