Skip to content

Commit

Permalink
Add new services
Browse files Browse the repository at this point in the history
  • Loading branch information
gkoberger committed Sep 20, 2016
1 parent 3159265 commit 078b03f
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 4 deletions.
25 changes: 25 additions & 0 deletions NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Flags for users
Env vars for scripts

api test --listen-peer test
export API_LISTEN_PEER=test


-------

You can look for API_* env variables and mention broken ones


--------

TODO:
-----

[ ] GitHub authentication
[ ] Style login on apis.host
[ ] All uploading goes through apis.host
[ ] Try pushing and:
[ ] reject if not logged in
[ ] send message if it is

aliases will go in ~/.api.json
2 changes: 1 addition & 1 deletion config/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"url": "http://apis.host"
},
"mock": {
"url": "http://mock.local:3020"
"url": "http://www.mock.tools"
}
}
2 changes: 1 addition & 1 deletion lib/host.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ exports.run = function(config, info) {
'swagger': JSON.stringify(info.swagger),
}
}, function(err, res, data) {
console.log(data);
console.log(err, data);
});
};
14 changes: 12 additions & 2 deletions lib/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,22 @@ var jsonfile = require('jsonfile')
var open = require('open');

exports.run = function(config, info) {
if(info.args[1] == 'info') {
try {
var user = jsonfile.readFileSync(config.apiFile);
} catch(e) {
console.log("You aren't logged in");
}
open('http://www.apis.host/info?token=' + user.token);

return;
}
var apiFile = config.apiFile;
var settings = {
token: require('crypto').randomBytes(48).toString('hex'),
token: require('crypto').randomBytes(15).toString('hex'),
};

jsonfile.writeFileSync(apiFile, settings)

open('http://apis.host/login.php?token=' + settings.token);
open('http://www.apis.host/login?token=' + settings.token);
};
1 change: 1 addition & 0 deletions lib/mock.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ exports.run = function(config, info) {

console.log("Success!".green.bold + " You now have an API you can test against:");
console.log("");
console.log(config.mock.url + '/upload', err, data);
console.log(" " + data.url);
console.log("");
if(samples.length) {
Expand Down

0 comments on commit 078b03f

Please sign in to comment.