-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcli.php
More file actions
78 lines (70 loc) · 1.82 KB
/
Copy pathcli.php
File metadata and controls
78 lines (70 loc) · 1.82 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
if (php_sapi_name() != 'cli') { exit(); }
include 'configs/config.php';
function dat_loader($class) {
include 'class/' . $class . '.php';
}
spl_autoload_register('dat_loader');
$statibus = new statibus(_rqliteIP,_rqlitePort);
if (count($argv) == 1) {
print("service, group, remote\n");
} else {
if ($argv[1] == "init") {
$statibus->sql()->init();
} elseif ($argv[1] == 'service') {
if (isset($argv[2])) {
switch ($argv[2]) {
case "add":
$statibus->serviceAdd($argv);
break;
case "list":
$statibus->list("services");
break;
case "delete":
$statibus->delete("services",$argv);
break;
}
} else {
print("service add <group> <name> <method> <target> <timeout> <httpcode(s)> <keyword>\n");
print("service list\n");
print("service delete <name>\n");
}
} elseif ($argv[1] == 'group') {
if (isset($argv[2])) {
switch ($argv[2]) {
case "add":
$statibus->groupAdd($argv);
break;
case "list":
$statibus->list("groups");
break;
case "delete":
$statibus->delete("groups",$argv);
break;
}
} else {
print("group add <name>\n");
print("group list\n");
print("group delete <name>\n");
}
} elseif ($argv[1] == 'remote') {
if (isset($argv[2])) {
switch ($argv[2]) {
case "add":
$statibus->remoteAdd($argv);
break;
case "list":
$statibus->list("remotes");
break;
case "delete":
$statibus->delete("remotes",$argv);
break;
}
} else {
print("remote add <name> <url>\n");
print("remote list\n");
print("remote delete <name>\n");
}
}
}
?>