welsonjs/lib/cloudflare.js

29 lines
875 B
JavaScript

////////////////////////////////////////////////////////////////////////
// Cloudflare API
////////////////////////////////////////////////////////////////////////
var SHELL = require("lib/shell");
var SYS = require("lib/system");
exports.VERSIONINFO = "Cloudflare Lib (cloudflare.js) version 0.1";
exports.global = global;
exports.require = global.require;
var arch = SYS.getArch();
if(arch.indexOf("64") > -1) {
exports.binPath = "bin/cloudflared-stable-windows-amd64/cloudflared";
} else {
exports.binPath = "bin/cloudflared-stable-windows-386/cloudflared";
}
// TODO: https://developers.cloudflare.com/access/rdp/rdp-guide/
exports.installService = function() {
var commandOptions = [];
commandOptions.push(exports.binPath);
commandOptions.push("service");
commandOptions.push("install");
return SHELL.exec(commandOptions.join(' '));
};