/*
 * @Description: 这是***页面（组件）
 * @Date: 2021-03-12 21:42:35
 * @Author: 米虫
 * @LastEditors: 莫靓仔
 * @LastEditTime: 2021-09-03 16:35:38
 * @description: 文件描述
 */
const envScpConfig = require('./env')
const os = require('os')
const fs = require('fs')

const env = process.env
//默认IOS LINUX
let homePath = env.HOME
//windows
if (os.type() == 'Windows_NT') homePath = env.USERPROFILE

const ciphertextPath = homePath + '/syc-vue-deploy/' + env.NODE_ENV + '.txt'

const ciphertext = fs.readFileSync(ciphertextPath, 'utf8')

let localScp = 0
try {
    const localScpPath = homePath + '/syc-vue-deploy/localScp.txt'
    localScp = fs.readFileSync(localScpPath, 'utf8')
} catch (error) {
    localScp = 0
}

if (!ciphertext) {
    throw new Error('获取不到密码！请联系管理员授权！')
}

envScpConfig[env.NODE_ENV]['password'] = ciphertext

envScpConfig[env.NODE_ENV]['localScp'] = localScp

module.exports = envScpConfig[env.NODE_ENV]
