Make ops tool work in production mode
This commit is contained in:
@@ -13,6 +13,7 @@ fi
|
|||||||
|
|
||||||
# For scripts that need config access
|
# For scripts that need config access
|
||||||
export NODE_CONFIG_DIR="${script_dir}/config"
|
export NODE_CONFIG_DIR="${script_dir}/config"
|
||||||
|
export NODE_ENV=production
|
||||||
|
|
||||||
if [[ ! -e "${script}" ]]; then
|
if [[ ! -e "${script}" ]]; then
|
||||||
echo error: Script ${script} does not exist
|
echo error: Script ${script} does not exist
|
||||||
|
|||||||
@@ -18,12 +18,11 @@ class AddUserTool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async run() {
|
async run() {
|
||||||
const mongoUri = config.get('uri.mongo')
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
const mongoUri = config.get('uri.mongo')
|
||||||
const db = await new DB().connect(mongoUri)
|
const db = await new DB().connect(mongoUri)
|
||||||
|
|
||||||
console.log(`Connected to MongoDB at ${mongoUri}`)
|
console.log(`Connected to MongoDB at '${mongoUri}'`)
|
||||||
|
|
||||||
const User = db.User
|
const User = db.User
|
||||||
let user = new User({
|
let user = new User({
|
||||||
|
|||||||
Reference in New Issue
Block a user