-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
59 lines (52 loc) · 1.26 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* # hsl-sop-app-config
*
* This module reretrieves all of the secure passwords, private keys, etc for
* the HSL SOP modules from a Google Cloud Storage bucket secured
* by one of the two OAuth Key stored here is this project. This is the singular
* place the keys can b efound. These keys nor this project should ever be
* shared by anyone working on HSP SOP.
*
* ## Install
*
* This module is NOT published to the NPM repository. Instead you should clone
* this project to a folder relative to the module you are working on, then
* NPM install as a relative fould. (See below.)
*
* ```
npm install ../hsl-sop-app-config --save
* ```
*
* ## Usage
*
* ```js
* var appConfigInit = require("hsl-sop-app-config");
*
* appConfigInit()
* .then(function(ac){
* appConfig = ac;
* done();
* })
* .catch(function(err){
* console.error(err);
* done(err);
* })
* ```
*/
var authenticate = require("./api-auth");
function SecureAppConfig(config) {
var me = this;
this.init = function () {
return authenticate(config)
.then(function (creds) {
Object.keys(creds).forEach(function (k) {
me[k] = creds[k];
});
return me;
})
.catch(function (err) {
throw err;
})
}
}
module.exports = SecureAppConfig;