Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -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.0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be 1.0.1

brylie:create-role-if-undefined@0.1.0
brylie:first-user-admin@0.1.9
brylie:leaflet-heat@0.1.0
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not also add a settings.json.example file to the project?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, done. I misunderstood your comment initially.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I meant 'adding'.

"mail": {
"username": "xxx",
Expand Down
2 changes: 1 addition & 1 deletion server/methods/apiBackends.js
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion server/methods/apiUmbrellaAdmins.js
Original file line number Diff line number Diff line change
@@ -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();

Expand Down
2 changes: 1 addition & 1 deletion server/methods/apiUmbrellaWeb.js
Original file line number Diff line number Diff line change
@@ -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();

Expand Down
2 changes: 1 addition & 1 deletion server/methods/settings.js
Original file line number Diff line number Diff line change
@@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion server/methods/status.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 10 additions & 0 deletions server/startup.js
Original file line number Diff line number Diff line change
@@ -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);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to write a check here, and in case of failure, halt the application. Consequently, the duplicated if (Meteor.settings.apiUmbrella) checks (server/methods/apiBackends.js, server/methods/apiUmbrellaAdmins.js, and server/methods/apiUmbrellaWeb.js) and can be deleted.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is a good point. However, the server methods may be used outside of the synced cron, so may still need to check for settings. E.g. if we want to sync after some user interaction, such as clicking a 'sync now' button.

// Check if API Umbrella settings are available
SyncedCron.add({
name: 'Sync API Umbrella Users and API Backends',
Expand Down