1 | 'use strict'
|
2 | function parseConf() {
|
3 | const configDir = process.env['_4EVERLINKCONF'] || process.env.HOME + "/.4everlink"
|
4 | const fs = require('fs')
|
5 | try{
|
6 | const path = require('path')
|
7 | const fileDir = path.resolve(configDir)
|
8 | const fileConfigPath = fileDir + "/conf.yaml"
|
9 | const stats = fs.statSync(fileConfigPath)
|
10 | if(stats.isFile) {
|
11 | const confContent = fs.readFileSync(fileConfigPath, 'utf-8')
|
12 | const YAML = require('yaml')
|
13 | const host = YAML.parse(confContent)
|
14 | return host
|
15 | }
|
16 | }catch(e) {
|
17 |
|
18 | }
|
19 | return {
|
20 | host: '127.0.0.1',
|
21 | port: '9094',
|
22 | token: '',
|
23 | }
|
24 | }
|
25 |
|
26 | exports = module.exports = parseConf |
\ | No newline at end of file |