Skip to content

Commit

Permalink
Merge pull request #67 from obeliss-nlesc/feature/config_file_path_fr…
Browse files Browse the repository at this point in the history
…om_cli

Feature/config file path from cli
  • Loading branch information
recap authored Jun 12, 2024
2 parents c880b77 + b4c2f8e commit 09ddc5c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const User = require("./user.js")
const Agreement = require("./agreement.js")
// const classLoader = require('./class_loader.js')
const ClassLoader = require("./class_loader.js")
const config = require("./config.json")
// const config = require("./config.json")
const { userInfo } = require("os")
const UserDb = require("./UserDb.js")

Expand All @@ -30,12 +30,16 @@ const secretKey = process.env.SECRET_KEY
const keyWordArray = CryptoJS.enc.Base64.parse(apiKey)

program
.option("-p, --port <int>", "server listen port")
.option("--reset-db", "reset users database")
.option("--db-file <type>", "user database file to use")
.option("-p, --port <int>", "server listen port.")
.option("-c, --config <type>", "config file path.")
.option("--reset-db", "reset users database.")
.option("--db-file <type>", "user database file to use.")

program.parse(process.argv)
const options = program.opts()
const config = options.config
? require(options.config)
: require("./config.json")

const port = options.port || "8060"
const userDbFile = options.dbFile || "./data/userdb.json"
Expand Down

0 comments on commit 09ddc5c

Please sign in to comment.