@leverege/build-tools 1.12.5 → 1.12.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/server/circleate +1 -1
- package/lib/server/dockreate +4 -8
- package/lib/server/helmify +36 -56
- package/lib/server/helmup +4 -1
- package/lib/web/dnsify/CloudflareAPI.js +126 -161
- package/lib/web/dnsify/index.js +46 -61
- package/lib/web/packleate/Packleator.js +396 -510
- package/lib/web/packleate/index.js +39 -54
- package/package.json +17 -17
- package/src/circleate +1 -1
- package/src/dockreate +4 -8
- package/src/helmify +36 -56
- package/src/helmup +4 -1
package/lib/server/circleate
CHANGED
|
@@ -375,7 +375,7 @@ jobs:
|
|
|
375
375
|
|
|
376
376
|
- run:
|
|
377
377
|
name: Check if coverage meets at least 70%
|
|
378
|
-
command: ./node_modules/.bin/nyc check-coverage --
|
|
378
|
+
command: ./node_modules/.bin/nyc check-coverage --functions 70 --lines 70 --statements 70
|
|
379
379
|
|
|
380
380
|
- run:
|
|
381
381
|
name: Generate docs
|
package/lib/server/dockreate
CHANGED
|
@@ -38,7 +38,7 @@ strip_undefined() {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
# Useful links with information regarding k8s/docker/nodejs and PID 1
|
|
41
|
-
# No PID 1 for NodeJS => https://bit.ly/
|
|
41
|
+
# No PID 1 for NodeJS => https://bit.ly/2r4gHkZ
|
|
42
42
|
# What tini is all about => https://bit.ly/2HsSxqP
|
|
43
43
|
# Graceful kills with k8s => https://bit.ly/2NONEJG
|
|
44
44
|
#
|
|
@@ -104,7 +104,6 @@ create_bashrc() {
|
|
|
104
104
|
#
|
|
105
105
|
# Version $1 @ `date`
|
|
106
106
|
|
|
107
|
-
alias golog='cd /var/log/levlog;ls -l'
|
|
108
107
|
alias h=history
|
|
109
108
|
|
|
110
109
|
alias ls='ls -CF --color=auto'
|
|
@@ -113,18 +112,15 @@ alias lla='ls -lha'
|
|
|
113
112
|
alias ltr='ls -CF --color=auto -lthr'
|
|
114
113
|
alias genv='env | grep -i'
|
|
115
114
|
alias glep='grep -l -s'
|
|
116
|
-
alias golog='cd /var/log/levlog'
|
|
117
115
|
alias m=less
|
|
118
116
|
alias menv='env | sort | less'
|
|
119
117
|
|
|
120
118
|
alias whatsmyip='wget -qO- ifconfig.co'
|
|
121
119
|
|
|
122
|
-
alias rcli='redis-cli -h \${DATABASES_REDIS_SERVICE_HOST}'
|
|
123
|
-
|
|
124
|
-
alias buny='/usr/src/app/node_modules/bunyan/bin/bunyan'
|
|
125
|
-
alias bunlog='golog;cat *-1.log | buny | m'
|
|
126
120
|
alias dbg='wget -q -O- localhost:5111/logLevel/debug'
|
|
127
121
|
alias inf='wget -q -O- localhost:5111/logLevel/info'
|
|
122
|
+
alias err='wget -q -O- localhost:5111/logLevel/error'
|
|
123
|
+
alias wrn='wget -q -O- localhost:5111/logLevel/warn'
|
|
128
124
|
|
|
129
125
|
loglev()
|
|
130
126
|
{
|
|
@@ -136,7 +132,7 @@ loglev()
|
|
|
136
132
|
logl="logLevel/\$1"
|
|
137
133
|
fi
|
|
138
134
|
|
|
139
|
-
printf "Running=> \$wget/\$logl\n"
|
|
135
|
+
printf "Running=> \$wget/\${logl}\n"
|
|
140
136
|
printf "\n\`\$wget/\$logl\`\n\n"
|
|
141
137
|
}
|
|
142
138
|
EOBASHRC
|
package/lib/server/helmify
CHANGED
|
@@ -53,32 +53,6 @@ spec:
|
|
|
53
53
|
SVC_YAML
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
createIngress(){
|
|
57
|
-
cat<<INGRESS_YAML > ingress.yaml
|
|
58
|
-
apiVersion: extensions/v1beta1
|
|
59
|
-
kind: Ingress
|
|
60
|
-
metadata:
|
|
61
|
-
name: $chartname-ingress
|
|
62
|
-
annotations:
|
|
63
|
-
kubernetes.io/ingress.global-static-ip-name: $chartname-ingress
|
|
64
|
-
spec:
|
|
65
|
-
tls:
|
|
66
|
-
- secretName: frontendtls
|
|
67
|
-
rules:
|
|
68
|
-
- host: {{ quote .Values.$chartname_go.INGRESS_HOST }}
|
|
69
|
-
http:
|
|
70
|
-
paths:
|
|
71
|
-
- backend:
|
|
72
|
-
serviceName: $chartname
|
|
73
|
-
servicePort: {{ .Values.$chartname_go.SERVER_PORT }}
|
|
74
|
-
- http:
|
|
75
|
-
paths:
|
|
76
|
-
- backend:
|
|
77
|
-
serviceName: $chartname
|
|
78
|
-
servicePort: {{ .Values.$chartname_go.SERVER_PORT }}
|
|
79
|
-
INGRESS_YAML
|
|
80
|
-
}
|
|
81
|
-
|
|
82
56
|
# Make chart directory
|
|
83
57
|
mkdir helm
|
|
84
58
|
mkdir helm/templates
|
|
@@ -90,13 +64,17 @@ PACKAGE_VERSION=$(node -p "require('../package.json').version")
|
|
|
90
64
|
|
|
91
65
|
cat<<CHARTYAML > Chart.yaml
|
|
92
66
|
name: $chartname
|
|
93
|
-
version: 1.0.0
|
|
94
|
-
appVersion: $PACKAGE_VERSION
|
|
67
|
+
version: 1.0.0 # version of the Helm Chart
|
|
68
|
+
appVersion: $PACKAGE_VERSION # minimum version of your application that is compatible with this chart
|
|
95
69
|
|
|
96
70
|
CHARTYAML
|
|
97
71
|
|
|
98
72
|
# Bootstrap values.yaml
|
|
99
73
|
cat<<VALUESYAML > values.yaml
|
|
74
|
+
### These are default env variable values for your application
|
|
75
|
+
### It is not actually used in production, but listed here for others as reference for what types of env variables are required.
|
|
76
|
+
### Overwrite these values in values-local or respective values files in platform-k8s
|
|
77
|
+
|
|
100
78
|
# List your env variables here
|
|
101
79
|
$chartname_go:
|
|
102
80
|
VERSION: vX.Y.Z
|
|
@@ -104,8 +82,6 @@ $chartname_go:
|
|
|
104
82
|
IMAGE: gcr.io/leverege-docker-images/$chartname
|
|
105
83
|
|
|
106
84
|
default:
|
|
107
|
-
LOG_DIR: "/var/log/levlog"
|
|
108
|
-
LOG_LEVEL: "info"
|
|
109
85
|
MAX_CHILD_PROCESSES: "1"
|
|
110
86
|
|
|
111
87
|
MODEL_FIREBASE_SERVICE_ACCOUNT: /var/config/keys/model-data
|
|
@@ -132,12 +108,7 @@ default:
|
|
|
132
108
|
\"name\": \"${logName}\",
|
|
133
109
|
\"level\": \"info\",
|
|
134
110
|
\"streams\": [
|
|
135
|
-
{
|
|
136
|
-
\"type\": \"rotating-file\",
|
|
137
|
-
\"period\": \"1d\",
|
|
138
|
-
\"count\": 3,
|
|
139
|
-
\"path\": \"/var/log/levlog/${logName}.log\"
|
|
140
|
-
}, {
|
|
111
|
+
{
|
|
141
112
|
\"type\": \"stackdriver\",
|
|
142
113
|
\"logName\": \"${logName}\"
|
|
143
114
|
}
|
|
@@ -172,13 +143,14 @@ cat<<DEPLOYMENT_YAML > deployment.yaml
|
|
|
172
143
|
apiVersion: apps/v1beta1
|
|
173
144
|
kind: Deployment
|
|
174
145
|
metadata:
|
|
175
|
-
name:
|
|
146
|
+
name: {{ .Chart.Name }}
|
|
176
147
|
spec:
|
|
177
148
|
template:
|
|
178
149
|
metadata:
|
|
179
150
|
labels:
|
|
180
|
-
app:
|
|
181
|
-
|
|
151
|
+
app: {{ .Chart.Name }}
|
|
152
|
+
chart/version: {{ .Chart.Version }}
|
|
153
|
+
chart/appVersion: {{ .Chart.AppVersion }}
|
|
182
154
|
annotations:
|
|
183
155
|
prometheus.io/port: '5111'
|
|
184
156
|
prometheus.io/scrape: 'true'
|
|
@@ -187,7 +159,7 @@ spec:
|
|
|
187
159
|
- name: model-firebase-key
|
|
188
160
|
secret:
|
|
189
161
|
secretName: model-data
|
|
190
|
-
- name:
|
|
162
|
+
- name: tmpfs
|
|
191
163
|
emptyDir: {}
|
|
192
164
|
- name: pubsub-key
|
|
193
165
|
secret:
|
|
@@ -208,7 +180,7 @@ spec:
|
|
|
208
180
|
- key: app
|
|
209
181
|
operator: In
|
|
210
182
|
values:
|
|
211
|
-
-
|
|
183
|
+
- {{ .Chart.Name }}
|
|
212
184
|
topologyKey: kubernetes.io/hostname
|
|
213
185
|
nodeAffinity:
|
|
214
186
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
@@ -219,15 +191,26 @@ spec:
|
|
|
219
191
|
weight: 50
|
|
220
192
|
{{- end }}
|
|
221
193
|
containers:
|
|
222
|
-
- name:
|
|
223
|
-
image:
|
|
194
|
+
- name: {{ .Chart.Name }}
|
|
195
|
+
image: {{ .Values.$chartname_go.IMAGE }}:{{ .Values.$chartname_go.VERSION }}
|
|
224
196
|
imagePullPolicy: Always
|
|
225
197
|
securityContext:
|
|
198
|
+
readOnlyRootFilesystem: true
|
|
199
|
+
runAsNonRoot: true
|
|
226
200
|
runAsUser: 1000
|
|
227
201
|
allowPrivilegeEscalation: false
|
|
202
|
+
readinessProbe:
|
|
203
|
+
httpGet:
|
|
204
|
+
path: /
|
|
205
|
+
port: node-metrics
|
|
206
|
+
initialDelaySeconds: 10
|
|
228
207
|
resources:
|
|
229
208
|
requests:
|
|
230
|
-
cpu: "
|
|
209
|
+
cpu: "50m"
|
|
210
|
+
memory: "256Mi"
|
|
211
|
+
limits:
|
|
212
|
+
cpu: "100m"
|
|
213
|
+
memory: "512Mi"
|
|
231
214
|
ports:
|
|
232
215
|
{{- if .Values.$chartname_go.SERVER_PORT }}
|
|
233
216
|
- name: api
|
|
@@ -238,8 +221,8 @@ spec:
|
|
|
238
221
|
volumeMounts:
|
|
239
222
|
- name: model-firebase-key
|
|
240
223
|
mountPath: {{ quote .Values.default.MODEL_FIREBASE_SERVICE_ACCOUNT }}
|
|
241
|
-
- name:
|
|
242
|
-
mountPath:
|
|
224
|
+
- name: tmpfs
|
|
225
|
+
mountPath: "/tmp"
|
|
243
226
|
- name: pubsub-key
|
|
244
227
|
mountPath: {{ quote .Values.default.PUBSUB_SERVICE_ACCOUNT }}
|
|
245
228
|
env:
|
|
@@ -251,10 +234,6 @@ spec:
|
|
|
251
234
|
value: {{ required "Limit config required" .Values.default.LIMIT_CONFIG | quote }}
|
|
252
235
|
- name: TRANSPORT_CONFIG
|
|
253
236
|
value: {{ required "Transport config required" .Values.default.TRANSPORT_CONFIG | quote }}
|
|
254
|
-
- name: LOG_DIR
|
|
255
|
-
value: {{ quote .Values.default.LOG_DIR }}
|
|
256
|
-
- name: LOG_LEVEL
|
|
257
|
-
value: {{ quote .Values.default.LOG_LEVEL }}
|
|
258
237
|
- name: LOG_CONFIG
|
|
259
238
|
value: {{ required "Log config required" .Values.default.LOG_CONFIG | quote }}
|
|
260
239
|
- name: MAX_CHILD_PROCESSES
|
|
@@ -270,11 +249,11 @@ echo # (optional) move to a new line
|
|
|
270
249
|
if [[ $REPLY =~ ^[Yy]$ ]]
|
|
271
250
|
then
|
|
272
251
|
echo
|
|
273
|
-
echo '
|
|
274
|
-
echo 'CREATING SERVICE
|
|
275
|
-
echo '
|
|
252
|
+
echo '**********************************'
|
|
253
|
+
echo ' CREATING SERVICE TEMPLATES '
|
|
254
|
+
echo '**********************************'
|
|
276
255
|
createService
|
|
277
|
-
|
|
256
|
+
|
|
278
257
|
fi
|
|
279
258
|
|
|
280
259
|
# Print out some hints
|
|
@@ -284,11 +263,12 @@ cat<<HINTS
|
|
|
284
263
|
|
|
285
264
|
1. You will need to add in additional env variables to both templates/*.yaml and values.yaml
|
|
286
265
|
2. You may not need all the default env variables so feel free to remove them as well
|
|
287
|
-
3.
|
|
266
|
+
3. Adjust limit/request cpu and memory values as needed
|
|
267
|
+
4. To use ingress, you need to reserve static ip then add to ingress templates in platform-k8s
|
|
288
268
|
|
|
289
269
|
Further instructions here: https://github.com/kelseyhightower/ingress-with-static-ip
|
|
290
270
|
|
|
291
|
-
|
|
271
|
+
5. Finally, follow chart museum directions to add your chart ors
|
|
292
272
|
|
|
293
273
|
helm push helm/ chartmuseum
|
|
294
274
|
|
package/lib/server/helmup
CHANGED
|
@@ -355,10 +355,13 @@ function doInstall() {
|
|
|
355
355
|
fi
|
|
356
356
|
HELMUP="helm upgrade --install $SERVICE chartmuseum/$MUSEUM -f $SERVICE/values.yaml $CHARTVER"
|
|
357
357
|
printf "Helming => `color g \"$HELMUP\"`\n" && $HELMUP
|
|
358
|
-
|
|
358
|
+
SAVERR=$?
|
|
359
|
+
if [ $SAVERR -ne 0 ];
|
|
359
360
|
then
|
|
360
361
|
cat<<NOTRUNNING
|
|
361
362
|
|
|
363
|
+
$RED_ERROR helm exited with error status: $SAVERR
|
|
364
|
+
|
|
362
365
|
$RED_ERROR The $SERVICE chart failed to upgrade or install. There may be an
|
|
363
366
|
issue with the service's helm charts, or chartmuseum may not be
|
|
364
367
|
up and running? If the latter, try firing it up with:
|
|
@@ -6,8 +6,6 @@ require("core-js/modules/es6.symbol");
|
|
|
6
6
|
|
|
7
7
|
require("core-js/modules/web.dom.iterable");
|
|
8
8
|
|
|
9
|
-
require("core-js/modules/es6.promise");
|
|
10
|
-
|
|
11
9
|
require("core-js/modules/es6.regexp.to-string");
|
|
12
10
|
|
|
13
11
|
require("core-js/modules/es6.object.to-string");
|
|
@@ -22,10 +20,6 @@ function _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) ||
|
|
|
22
20
|
|
|
23
21
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
24
22
|
|
|
25
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
26
|
-
|
|
27
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
28
|
-
|
|
29
23
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
30
24
|
|
|
31
25
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
@@ -64,80 +58,71 @@ function () {
|
|
|
64
58
|
|
|
65
59
|
_createClass(CloudflareAPI, [{
|
|
66
60
|
key: "decrypt",
|
|
67
|
-
value: function () {
|
|
68
|
-
var
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
case "end":
|
|
129
|
-
return _context.stop();
|
|
130
|
-
}
|
|
61
|
+
value: function decrypt() {
|
|
62
|
+
var projectId,
|
|
63
|
+
keyRingId,
|
|
64
|
+
cryptoKeyId,
|
|
65
|
+
ciphertextFileName,
|
|
66
|
+
plaintextFileName,
|
|
67
|
+
kms,
|
|
68
|
+
client,
|
|
69
|
+
locationId,
|
|
70
|
+
readFile,
|
|
71
|
+
contentsBuffer,
|
|
72
|
+
name,
|
|
73
|
+
ciphertext,
|
|
74
|
+
_ref,
|
|
75
|
+
_ref2,
|
|
76
|
+
result,
|
|
77
|
+
writeFile,
|
|
78
|
+
_args = arguments;
|
|
79
|
+
|
|
80
|
+
return regeneratorRuntime.async(function decrypt$(_context) {
|
|
81
|
+
while (1) {
|
|
82
|
+
switch (_context.prev = _context.next) {
|
|
83
|
+
case 0:
|
|
84
|
+
projectId = _args.length > 0 && _args[0] !== undefined ? _args[0] : 'leverege-docker-images';
|
|
85
|
+
keyRingId = _args.length > 1 && _args[1] !== undefined ? _args[1] : 'build-tools';
|
|
86
|
+
cryptoKeyId = _args.length > 2 && _args[2] !== undefined ? _args[2] : 'circle-ci';
|
|
87
|
+
ciphertextFileName = _args.length > 3 && _args[3] !== undefined ? _args[3] : './accounts.json.enc';
|
|
88
|
+
plaintextFileName = _args.length > 4 && _args[4] !== undefined ? _args[4] : './accounts.json';
|
|
89
|
+
// Import the library and create a client
|
|
90
|
+
kms = require('@google-cloud/kms');
|
|
91
|
+
client = new kms.KeyManagementServiceClient(); // The location of the crypto key's key ring, e.g. "global"
|
|
92
|
+
|
|
93
|
+
locationId = 'us-east4'; // Reads the file to be decrypted
|
|
94
|
+
|
|
95
|
+
readFile = promisify(fs.readFile);
|
|
96
|
+
_context.next = 11;
|
|
97
|
+
return regeneratorRuntime.awrap(readFile(path.resolve(__dirname, ciphertextFileName)));
|
|
98
|
+
|
|
99
|
+
case 11:
|
|
100
|
+
contentsBuffer = _context.sent;
|
|
101
|
+
name = client.cryptoKeyPath(projectId, locationId, keyRingId, cryptoKeyId);
|
|
102
|
+
ciphertext = contentsBuffer.toString('base64'); // Decrypts the file using the specified crypto key
|
|
103
|
+
|
|
104
|
+
_context.next = 16;
|
|
105
|
+
return regeneratorRuntime.awrap(client.decrypt({
|
|
106
|
+
name: name,
|
|
107
|
+
ciphertext: ciphertext
|
|
108
|
+
}));
|
|
109
|
+
|
|
110
|
+
case 16:
|
|
111
|
+
_ref = _context.sent;
|
|
112
|
+
_ref2 = _slicedToArray(_ref, 1);
|
|
113
|
+
result = _ref2[0];
|
|
114
|
+
// Writes the decrypted file to disk
|
|
115
|
+
writeFile = promisify(fs.writeFile);
|
|
116
|
+
_context.next = 22;
|
|
117
|
+
return regeneratorRuntime.awrap(writeFile(path.resolve(__dirname, plaintextFileName), Buffer.from(result.plaintext, 'base64')));
|
|
118
|
+
|
|
119
|
+
case 22:
|
|
120
|
+
case "end":
|
|
121
|
+
return _context.stop();
|
|
131
122
|
}
|
|
132
|
-
}
|
|
133
|
-
})
|
|
134
|
-
|
|
135
|
-
function decrypt() {
|
|
136
|
-
return _decrypt.apply(this, arguments);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
return decrypt;
|
|
140
|
-
}()
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
}
|
|
141
126
|
}, {
|
|
142
127
|
key: "setAccountValues",
|
|
143
128
|
value: function setAccountValues() {
|
|
@@ -155,92 +140,72 @@ function () {
|
|
|
155
140
|
}
|
|
156
141
|
}, {
|
|
157
142
|
key: "deleteSecrets",
|
|
158
|
-
value: function () {
|
|
159
|
-
var
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
case 3:
|
|
172
|
-
case "end":
|
|
173
|
-
return _context2.stop();
|
|
174
|
-
}
|
|
143
|
+
value: function deleteSecrets() {
|
|
144
|
+
var deleteFile;
|
|
145
|
+
return regeneratorRuntime.async(function deleteSecrets$(_context2) {
|
|
146
|
+
while (1) {
|
|
147
|
+
switch (_context2.prev = _context2.next) {
|
|
148
|
+
case 0:
|
|
149
|
+
deleteFile = promisify(fs.unlink);
|
|
150
|
+
_context2.next = 3;
|
|
151
|
+
return regeneratorRuntime.awrap(deleteFile(path.resolve(__dirname, './accounts.json')));
|
|
152
|
+
|
|
153
|
+
case 3:
|
|
154
|
+
case "end":
|
|
155
|
+
return _context2.stop();
|
|
175
156
|
}
|
|
176
|
-
}
|
|
177
|
-
})
|
|
178
|
-
|
|
179
|
-
function deleteSecrets() {
|
|
180
|
-
return _deleteSecrets.apply(this, arguments);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
return deleteSecrets;
|
|
184
|
-
}()
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
}
|
|
185
160
|
}, {
|
|
186
161
|
key: "createDNSRecord",
|
|
187
|
-
value: function () {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
case 21:
|
|
231
|
-
case "end":
|
|
232
|
-
return _context3.stop();
|
|
233
|
-
}
|
|
162
|
+
value: function createDNSRecord() {
|
|
163
|
+
return regeneratorRuntime.async(function createDNSRecord$(_context3) {
|
|
164
|
+
while (1) {
|
|
165
|
+
switch (_context3.prev = _context3.next) {
|
|
166
|
+
case 0:
|
|
167
|
+
_context3.prev = 0;
|
|
168
|
+
this.spinner.start();
|
|
169
|
+
this.spinner.text = 'Decrypting Cloudflare secrets...';
|
|
170
|
+
_context3.next = 5;
|
|
171
|
+
return regeneratorRuntime.awrap(this.decrypt());
|
|
172
|
+
|
|
173
|
+
case 5:
|
|
174
|
+
this.spinner.text = 'Initializing Cloudflare API...';
|
|
175
|
+
this.setAccountValues();
|
|
176
|
+
this.spinner.text = 'Adding A name record...';
|
|
177
|
+
_context3.next = 10;
|
|
178
|
+
return regeneratorRuntime.awrap(this.cf.dnsRecords.add(this.zone, {
|
|
179
|
+
type: 'A',
|
|
180
|
+
name: this.url,
|
|
181
|
+
content: this.ipaddress,
|
|
182
|
+
proxied: this.proxy
|
|
183
|
+
}));
|
|
184
|
+
|
|
185
|
+
case 10:
|
|
186
|
+
this.spinner.text = 'Removing secrets...';
|
|
187
|
+
_context3.next = 13;
|
|
188
|
+
return regeneratorRuntime.awrap(this.deleteSecrets());
|
|
189
|
+
|
|
190
|
+
case 13:
|
|
191
|
+
this.spinner.stop();
|
|
192
|
+
_context3.next = 21;
|
|
193
|
+
break;
|
|
194
|
+
|
|
195
|
+
case 16:
|
|
196
|
+
_context3.prev = 16;
|
|
197
|
+
_context3.t0 = _context3["catch"](0);
|
|
198
|
+
this.spinner.stop();
|
|
199
|
+
console.log(_context3.t0);
|
|
200
|
+
throw _context3.t0;
|
|
201
|
+
|
|
202
|
+
case 21:
|
|
203
|
+
case "end":
|
|
204
|
+
return _context3.stop();
|
|
234
205
|
}
|
|
235
|
-
}
|
|
236
|
-
})
|
|
237
|
-
|
|
238
|
-
function createDNSRecord() {
|
|
239
|
-
return _createDNSRecord.apply(this, arguments);
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
return createDNSRecord;
|
|
243
|
-
}()
|
|
206
|
+
}
|
|
207
|
+
}, null, this, [[0, 16]]);
|
|
208
|
+
}
|
|
244
209
|
}]);
|
|
245
210
|
|
|
246
211
|
return CloudflareAPI;
|