-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirst-openmix-app.js
37 lines (33 loc) · 1.15 KB
/
first-openmix-app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//Xavier's first app
function init(config) {
// useless for the time being
'use strict';
config.requireProvider('akamai_object_delivery');
config.requireProvider('aws_ec2_us_east_va');
config.requireProvider('cloudflare_cdn');
}
var round = 0;
function onRequest(request, response) {
// cycles through all servers I want to cycle through.
'use strict';
if (round === 0) {
response.setProvider('akamai_object_delivery');
// response.respond('akamai_object_delivery', '4.4.4.4');
response.addARecord('1.1.1.1');
response.addARecord('2.2.2.2');
response.addARecord('3.3.3.3');
response.addARecord('4.4.4.4');
response.setTTL(20);
} else if (round === 1) {
// why is specifying the provider alias important?
response.respond('aws_ec2_us_east_va', '8.8.8.8');
response.setTTL(30);
} else if (round === 2) {
//response.respond('akamai_object_delivery', '8.8.4.4');
//response.setTTL(20);
response.setProvider('cloudflare_cdn');
response.addCName('bar.foo.com');
response.setTTL(25);
}
round = (round + 1) % 3;
}