From eee72838ba11eb3874588f5fff04bea07adc0f9c Mon Sep 17 00:00:00 2001 From: PhantasWeng Date: Tue, 4 Dec 2018 14:55:12 +0800 Subject: [PATCH] Fixed env issues --- onDuty.js | 9 ++++----- package.json | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/onDuty.js b/onDuty.js index 3f0b2fa..2f7ee34 100644 --- a/onDuty.js +++ b/onDuty.js @@ -5,10 +5,9 @@ const { TimeoutError } = require('puppeteer/Errors') const dateFns = require('date-fns'); const colors = require('colors'); -let useEnv = true -let userName = useEnv ? process.env.userName : myConfig.userName -let password = useEnv ? '*'.repeat(process.env.password.length) : myConfig.password -let loginUrl = useEnv ? process.env.loginUrl : myConfig.loginUrl +let userName = process.env.userName +let password = process.env.password +let loginUrl = process.env.loginUrl program .version('onDuty.js: Version 0.1.0') @@ -44,7 +43,6 @@ program } function setConfig (data) { - useEnv = false userName = data.userName password = data.password loginUrl = data.loginUrl @@ -54,6 +52,7 @@ const punchDuty = async () => { console.log(`${colors.yellow('env 目前設定:')} userName = ${colors.green(userName)} password = ${colors.green('*'.repeat(password.length))} + password = ${colors.green(password)} loginUrl = ${colors.green(loginUrl)} `) const launchOptions = { diff --git a/package.json b/package.json index 02f24c7..ede2ebd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "onDutyJs", - "version": "1.2.0", + "version": "1.2.1", "description": "onDuty for tubeHR (Apollo XE)", "author": "Phantasweng ", "main": "onDuty.js",