diff --git a/.meteor/versions b/.meteor/versions index ecd1cba6e4..62befeed9c 100644 --- a/.meteor/versions +++ b/.meteor/versions @@ -23,7 +23,7 @@ blaze-tools@1.0.4 boilerplate-generator@1.0.4 bruz:github-api@0.2.4_1 brylie:accounts-admin-ui@0.3.0 -brylie:api-umbrella@0.2.12 +brylie:api-umbrella@1.0.1 brylie:create-role-if-undefined@0.1.0 brylie:first-user-admin@0.1.9 brylie:leaflet-heat@0.1.0 diff --git a/README.md b/README.md index 50ab6a57d3..80cf46dd02 100644 --- a/README.md +++ b/README.md @@ -42,11 +42,11 @@ Your `settings.json` file should have the following structure: "apinf": { "host": "https://example.com/" }, - "api_umbrella": { - "host": "https://example.com/" - "api_key": "xxx", - "auth_token": "xxx", - "base_url": "https://example.com/api-umbrella/" + "apiUmbrella": { + "apiKey": "xxx", + "authToken": "xxx", + "baseUrl": "https://example.com/api-umbrella/", + "host": "https://example.com" }, "mail": { "username": "xxx", diff --git a/config.json.example b/config.json.example new file mode 100644 index 0000000000..29d5fd485e --- /dev/null +++ b/config.json.example @@ -0,0 +1,22 @@ +{ + "apinf": { + "host": "https://example.com/" + }, + "apiUmbrella": { + "apiKey": "xxx", + "authToken": "xxx", + "baseUrl": "https://example.com/api-umbrella/", + "host": "https://example.com" + }, + "mail": { + "username": "xxx", + "password": "xxx" + }, + "elasticsearch": { + "host": "http://example.com:14002/" + }, + "githubConfiguration": { + "clientId" : "xxx", + "secret" : "xxx" + } +} diff --git a/server/methods/apiBackends.js b/server/methods/apiBackends.js index 519ecad5c1..44a1baaea2 100644 --- a/server/methods/apiBackends.js +++ b/server/methods/apiBackends.js @@ -1,7 +1,7 @@ Meteor.methods({ "syncApiBackends":function () { // Check if API Umbrella settings are available - if (Meteor.settings.api_umbrella) { + if (Meteor.settings.apiUmbrella) { // Get API Backends from API Umbrella instance var response = apiUmbrellaWeb.adminApi.v1.apiBackends.getApiBackends(); var apiBackends = response.data.data; diff --git a/server/methods/apiUmbrellaAdmins.js b/server/methods/apiUmbrellaAdmins.js index af939fc1cd..3c5736f0f0 100644 --- a/server/methods/apiUmbrellaAdmins.js +++ b/server/methods/apiUmbrellaAdmins.js @@ -1,6 +1,6 @@ Meteor.methods({ "syncApiUmbrellaAdmins": function () { - if (Meteor.settings.api_umbrella) { + if (Meteor.settings.apiUmbrella) { // Get admin users from API Umbrella instance var response = apiUmbrellaWeb.adminApi.v1.adminUsers.getAdmins(); diff --git a/server/methods/apiUmbrellaWeb.js b/server/methods/apiUmbrellaWeb.js index 53243163f6..e6b3a13c25 100644 --- a/server/methods/apiUmbrellaWeb.js +++ b/server/methods/apiUmbrellaWeb.js @@ -1,6 +1,6 @@ Meteor.methods({ "syncApiUmbrellaUsers": function () { - if (Meteor.settings.api_umbrella) { + if (Meteor.settings.apiUmbrella) { // Get users from API Umbrella instance var response = apiUmbrellaWeb.adminApi.v1.apiUsers.getUsers(); diff --git a/server/methods/settings.js b/server/methods/settings.js index 6c8d2309af..9bedb3cb99 100644 --- a/server/methods/settings.js +++ b/server/methods/settings.js @@ -1,7 +1,7 @@ Meteor.methods({ 'getApiUmbrellaBaseUrl': function () { // Get base url from settings file - var apiUmbrellaBaseUrl = Meteor.settings.api_umbrella.base_url; + var apiUmbrellaBaseUrl = Meteor.settings.apiUmbrella.baseUrl; return apiUmbrellaBaseUrl; } diff --git a/server/methods/status.js b/server/methods/status.js index 28b69b71ee..42296a22e8 100644 --- a/server/methods/status.js +++ b/server/methods/status.js @@ -49,7 +49,7 @@ Meteor.methods({ try{ // initial host for API umbrella - var apiUmbrellaHost = Meteor.settings.api_umbrella.host; + var apiUmbrellaHost = Meteor.settings.apiUmbrella.host; // response object from API Umbrella GET request var apiUmbrellaResponse = Meteor.http.call("GET", apiUmbrellaHost); diff --git a/server/startup.js b/server/startup.js index f6482bdf80..b39a9e8ee1 100644 --- a/server/startup.js +++ b/server/startup.js @@ -1,4 +1,14 @@ Meteor.startup(function () { + // Create config object for API Umbrella Web interface + var config = { + baseUrl: Meteor.settings.apiUmbrella.baseUrl, + apiKey: Meteor.settings.apiUmbrella.apiKey, + authToken: Meteor.settings.apiUmbrella.authToken + }; + + // Create API Umbrella Web object for REST calls + apiUmbrellaWeb = new ApiUmbrellaWeb(config); + // Check if API Umbrella settings are available SyncedCron.add({ name: 'Sync API Umbrella Users and API Backends',