Skip to content

Commit

Permalink
use environment variables for configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
CorySanin committed Aug 9, 2020
1 parent 82ec847 commit f7b19b2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 37 deletions.
14 changes: 7 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ const proxy = httpProxy.createProxyServer({
});

let config = {
port: 8080,
blacklist: true,
domainlist: [],
deepproxy: false,
logrequestnum: false,
logrequestdomains: false,
port: process.env.PORT || 8080,
blacklist: (process.env.BLACKLIST || 'true').toLowerCase() === 'true',
domainlist: (process.env.DOMAINLIST) ? process.env.DOMAINLIST.split(',') : [],
deepproxy: (process.env.DEEPPROXY || 'false').toLowerCase() === 'true',
logrequestnum: (process.env.LOGREQUESTNUM || 'false').toLowerCase() === 'true',
logrequestdomains: (process.env.LOGREQUESTDOMAINS || 'false').toLowerCase() === 'true',
logdir: './'
}

Expand Down Expand Up @@ -173,7 +173,7 @@ fs.readFile(cfgfile, 'utf8', function (err, data) {
}
}
catch (e) {
console.log(e);
console.log('config file couldn\'t be read. Using defaults and environment variables instead.');
}
}
else {
Expand Down
38 changes: 10 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"repository": "https://github.com/CorySanin/patreon-to-zune",
"dependencies": {
"express": "4.17.1",
"phin": "3.4.1",
"http-proxy": "1.18.0"
"http-proxy": "^1.18.1",
"phin": "3.4.1"
}
}

0 comments on commit f7b19b2

Please sign in to comment.