Compare commits
16 Commits
Author | SHA1 | Date | |
---|---|---|---|
c76643d700 | |||
de088ba550 | |||
1ecf660368 | |||
a04ce339f2 | |||
feed201dc1 | |||
cb73164c8f | |||
4758f31132 | |||
5a0ab5080d | |||
26bb194814 | |||
4a656cf7f1 | |||
9a35e69ab6 | |||
757a9acd09 | |||
9cb3c1508e | |||
d25033b84b | |||
941611b7fb | |||
441d66d6f6 |
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,8 +1,6 @@
|
||||
coverage/
|
||||
docs/
|
||||
ts/typings/
|
||||
ts/**/*.js
|
||||
ts/**/*.js.map
|
||||
.idea/
|
||||
node_modules/
|
||||
|
||||
.nogit/
|
||||
nogit/
|
||||
|
43
.gitlab-ci.yml
Normal file
43
.gitlab-ci.yml
Normal file
@ -0,0 +1,43 @@
|
||||
image: hosttoday/ht-docker-node:npmts
|
||||
|
||||
stages:
|
||||
- test1
|
||||
- test2
|
||||
- test3
|
||||
- release
|
||||
|
||||
testLEGACY:
|
||||
stage: test1
|
||||
script:
|
||||
- npmci test legacy
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
|
||||
testLTS:
|
||||
stage: test2
|
||||
script:
|
||||
- npmci test lts
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
|
||||
testSTABLE:
|
||||
stage: test3
|
||||
script:
|
||||
- npmci test stable
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
||||
|
||||
release:
|
||||
stage: release
|
||||
script:
|
||||
- npmci publish
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
130
dist/cflare.classes.cflareaccount.js
vendored
130
dist/cflare.classes.cflareaccount.js
vendored
File diff suppressed because one or more lines are too long
3
dist/cflare.classes.helpers.js
vendored
3
dist/cflare.classes.helpers.js
vendored
@ -1,4 +1,3 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNmbGFyZS5jbGFzc2VzLmhlbHBlcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQSIsImZpbGUiOiJjZmxhcmUuY2xhc3Nlcy5oZWxwZXJzLmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy1nbG9iYWxcIjtcclxuaW1wb3J0IHBsdWdpbnMgPSByZXF1aXJlKFwiLi9jZmxhcmUucGx1Z2luc1wiKTsiXX0=
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2ZsYXJlLmNsYXNzZXMuaGVscGVycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2NmbGFyZS5jbGFzc2VzLmhlbHBlcnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQWdCLENBQUMsQ0FBQSJ9
|
3
dist/cflare.plugins.js
vendored
3
dist/cflare.plugins.js
vendored
@ -4,5 +4,4 @@ exports.beautylog = require("beautylog");
|
||||
exports.q = require("q");
|
||||
exports.request = require("request");
|
||||
exports.smartstring = require("smartstring");
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNmbGFyZS5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDYixpQkFBUyxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQztBQUNqQyxTQUFDLEdBQUcsT0FBTyxDQUFDLEdBQUcsQ0FBQyxDQUFDO0FBQ2pCLGVBQU8sR0FBRyxPQUFPLENBQUMsU0FBUyxDQUFDLENBQUM7QUFDMUIsbUJBQVcsV0FBVyxhQUFhLENBQUMsQ0FBQyIsImZpbGUiOiJjZmxhcmUucGx1Z2lucy5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCI7XHJcbmV4cG9ydCBsZXQgYmVhdXR5bG9nID0gcmVxdWlyZShcImJlYXV0eWxvZ1wiKTtcclxuZXhwb3J0IGxldCBxID0gcmVxdWlyZShcInFcIik7XHJcbmV4cG9ydCBsZXQgcmVxdWVzdCA9IHJlcXVpcmUoXCJyZXF1ZXN0XCIpO1xyXG5leHBvcnQgaW1wb3J0IHNtYXJ0c3RyaW5nID0gcmVxdWlyZShcInNtYXJ0c3RyaW5nXCIpOyJdfQ==
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2ZsYXJlLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9jZmxhcmUucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ2IsaUJBQVMsR0FBRyxPQUFPLENBQUMsV0FBVyxDQUFDLENBQUM7QUFDakMsU0FBQyxHQUFHLE9BQU8sQ0FBQyxHQUFHLENBQUMsQ0FBQztBQUNqQixlQUFPLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0FBQzFCLG1CQUFXLFdBQVcsYUFBYSxDQUFDLENBQUMifQ==
|
3
dist/index.js
vendored
3
dist/index.js
vendored
@ -2,5 +2,4 @@
|
||||
require("typings-global");
|
||||
var cflare_classes_cflareaccount_1 = require("./cflare.classes.cflareaccount");
|
||||
exports.CflareAccount = cflare_classes_cflareaccount_1.CflareAccount;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDeEIsNkNBQTRCLGdDQUFnQyxDQUFDO0FBQXJELHFFQUFxRCIsImZpbGUiOiJpbmRleC5qcyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBcInR5cGluZ3MtZ2xvYmFsXCI7XHJcbmV4cG9ydCB7Q2ZsYXJlQWNjb3VudH0gZnJvbSBcIi4vY2ZsYXJlLmNsYXNzZXMuY2ZsYXJlYWNjb3VudFwiOyJdfQ==
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ3hCLDZDQUE0QixnQ0FBZ0MsQ0FBQztBQUFyRCxxRUFBcUQifQ==
|
16
package.json
16
package.json
@ -1,8 +1,9 @@
|
||||
{
|
||||
"name": "cflare",
|
||||
"version": "0.0.3",
|
||||
"version": "0.0.10",
|
||||
"description": "cloudflare management for CoreOS",
|
||||
"main": "dist/index.js",
|
||||
"typings": "dist/index.d.ts",
|
||||
"scripts": {
|
||||
"test": "(npmts)"
|
||||
},
|
||||
@ -21,15 +22,16 @@
|
||||
},
|
||||
"homepage": "https://github.com/pushrocks/cflare#readme",
|
||||
"dependencies": {
|
||||
"beautylog": "^5.0.6",
|
||||
"beautylog": "^5.0.18",
|
||||
"q": "^1.4.1",
|
||||
"request": "^2.72.0",
|
||||
"smartstring": "^2.0.1",
|
||||
"typings-global": "^1.0.3"
|
||||
"request": "^2.74.0",
|
||||
"smartstring": "^2.0.15",
|
||||
"typings-global": "^1.0.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"npmts": "^5.1.14",
|
||||
"should": "^8.4.0",
|
||||
"npmts-g": "^5.2.8",
|
||||
"qenv": "^1.0.8",
|
||||
"should": "^10.0.0",
|
||||
"typings-test": "^1.0.1"
|
||||
}
|
||||
}
|
||||
|
54
test/test.js
54
test/test.js
File diff suppressed because one or more lines are too long
40
test/test.ts
40
test/test.ts
@ -1,18 +1,19 @@
|
||||
import "typings-test";
|
||||
import cflare = require("../dist/index");
|
||||
let should = require("should");
|
||||
let nogit = require("../nogit/nogit.json");
|
||||
|
||||
import {Qenv} from "qenv";
|
||||
let testQenv = new Qenv(process.cwd(),process.cwd() + "/.nogit");
|
||||
console.log(testQenv.missingEnvVars);
|
||||
let testCflareAccount = new cflare.CflareAccount();
|
||||
testCflareAccount.auth({
|
||||
email: nogit.cfemail,
|
||||
key: nogit.cfkey
|
||||
email: process.env.CF_EMAIL,
|
||||
key: process.env.CF_KEY
|
||||
});
|
||||
|
||||
describe("cflare",function(){
|
||||
describe(".CflareAccount",function(){
|
||||
describe(".listZones()",function(){
|
||||
it("should display an account",function(done){
|
||||
it("should display an entire account",function(done){
|
||||
this.timeout(10000);
|
||||
testCflareAccount.listZones()
|
||||
.then((responseArg)=>{
|
||||
@ -24,7 +25,7 @@ describe("cflare",function(){
|
||||
describe(".getZoneId(domainName)",function(){
|
||||
it("should get an Cloudflare Id for a domain string",function(done){
|
||||
this.timeout(10000)
|
||||
testCflareAccount.getZoneId("push.rocks")
|
||||
testCflareAccount.getZoneId("bleu.de")
|
||||
.then((responseArg)=>{
|
||||
console.log(responseArg);
|
||||
done();
|
||||
@ -34,7 +35,7 @@ describe("cflare",function(){
|
||||
describe(".listRecords(domainName)",function(){
|
||||
it("should list all records for a specific Domain Name",function(done){
|
||||
this.timeout(10000);
|
||||
testCflareAccount.listRecords("push.rocks")
|
||||
testCflareAccount.listRecords("bleu.de")
|
||||
.then((responseArg) => {
|
||||
console.log(responseArg);
|
||||
done();
|
||||
@ -58,14 +59,31 @@ describe("cflare",function(){
|
||||
});
|
||||
});
|
||||
});
|
||||
describe(".removeRecord",function(){
|
||||
/*it("should remove a record from Cloudflare",function(done){
|
||||
testCflareAccount.removeRecord()
|
||||
describe(".getRecord",function(){
|
||||
it("should get a record from Cloudflare",function(done){
|
||||
testCflareAccount.getRecord("bleu.de","A")
|
||||
.then(function(responseArg){
|
||||
console.log(responseArg);
|
||||
done();
|
||||
});
|
||||
});*/
|
||||
});
|
||||
});
|
||||
describe(".removeRecord",function(){
|
||||
it("should remove a record from Cloudflare",function(done){
|
||||
testCflareAccount.removeRecord("bleu.de","A")
|
||||
.then(function(responseArg){
|
||||
console.log(responseArg);
|
||||
done();
|
||||
});
|
||||
});
|
||||
it("should remove a subdomain record from Cloudflare",function(done){
|
||||
this.timeout(5000);
|
||||
testCflareAccount.removeRecord("subdomain.bleu.de","A")
|
||||
.then(function(responseArg){
|
||||
console.log(responseArg);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
})
|
||||
});
|
||||
|
@ -39,6 +39,7 @@ export class CflareAccount {
|
||||
let filteredResponse = responseArg.result.filter((recordArg) => {
|
||||
return (recordArg.type == typeArg && recordArg.name == domainNameArg);
|
||||
})
|
||||
done.resolve(filteredResponse[0]);
|
||||
})
|
||||
return done.promise;
|
||||
};
|
||||
@ -62,9 +63,17 @@ export class CflareAccount {
|
||||
removeRecord(domainNameArg:string,typeArg:string){
|
||||
let done = plugins.q.defer();
|
||||
let domain = new plugins.smartstring.Domain(domainNameArg);
|
||||
this.getRecord(domain.zoneName,typeArg)
|
||||
this.getRecord(domain.fullName,typeArg)
|
||||
.then((responseArg) => {
|
||||
|
||||
if(responseArg){
|
||||
let requestRoute:string = "/zones/" + responseArg.zone_id + "/dns_records/" + responseArg.id;
|
||||
this.request("DELETE",requestRoute)
|
||||
.then((responseArg) => {
|
||||
done.resolve(responseArg);
|
||||
});
|
||||
} else {
|
||||
done.reject();
|
||||
}
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
@ -110,6 +119,7 @@ export class CflareAccount {
|
||||
},
|
||||
body:jsonArg
|
||||
};
|
||||
//console.log(options);
|
||||
plugins.request(options,function(err, res, body){
|
||||
if (!err && res.statusCode == 200) {
|
||||
var responseObj = JSON.parse(body);
|
||||
|
@ -1,9 +0,0 @@
|
||||
{
|
||||
"version": false,
|
||||
"dependencies": {},
|
||||
"ambientDependencies": {
|
||||
"colors": "registry:dt/colors#0.6.0-1+20160425153322",
|
||||
"mocha": "registry:dt/mocha#2.2.5+20160317120654",
|
||||
"node": "registry:dt/node#4.0.0+20160423143914"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user