config.json case bugfixe
This commit is contained in:
parent
4301e3003f
commit
092df29869
6
app.js
6
app.js
|
|
@ -6,7 +6,7 @@ const NTFY = require('./lib/ntfy')
|
||||||
const Constants = require('./lib/constants')
|
const Constants = require('./lib/constants')
|
||||||
|
|
||||||
new class LottoAutomation {
|
new class LottoAutomation {
|
||||||
#configFilename = process.env.LOTTO_AUTOMATION_CONFIG_FILENAME ?? 'Config.json'
|
#configFilename = process.env.LOTTO_AUTOMATION_CONFIG_FILENAME ?? 'config.json'
|
||||||
#configPath = `${process.env.LOTTO_AUTOMATION_CONFIG_DIR ?? __dirname}/${this.#configFilename}`
|
#configPath = `${process.env.LOTTO_AUTOMATION_CONFIG_DIR ?? __dirname}/${this.#configFilename}`
|
||||||
#config = {}
|
#config = {}
|
||||||
|
|
||||||
|
|
@ -16,14 +16,14 @@ new class LottoAutomation {
|
||||||
}
|
}
|
||||||
#_loadConfig() {
|
#_loadConfig() {
|
||||||
if(!Fs.existsSync(this.#configPath))
|
if(!Fs.existsSync(this.#configPath))
|
||||||
throw new Error('Config.json 파일이 존재하지 않습니다.')
|
throw new Error('config.json 파일이 존재하지 않습니다.')
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const configString = Fs.readFileSync(this.#configPath)
|
const configString = Fs.readFileSync(this.#configPath)
|
||||||
this.#config = JSON.parse(configString)
|
this.#config = JSON.parse(configString)
|
||||||
NTFY.Init(this.#config.ntfyUrl, this.#config.ntfyToken)
|
NTFY.Init(this.#config.ntfyUrl, this.#config.ntfyToken)
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
throw new Error('Config.json 파일이 올바르지 않습니다.')
|
throw new Error('config.json 파일이 올바르지 않습니다.')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
async #_buyLotto() {
|
async #_buyLotto() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue