Skip to content

Commit bbeb6ab

Browse files
Merge pull request #269 from CiderAndWhisky
Add a JSON Schema file
2 parents cb0ef4c + 4bb5ea5 commit bbeb6ab

File tree

1 file changed

+340
-0
lines changed

1 file changed

+340
-0
lines changed

phpbu.schema.json

Lines changed: 340 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,340 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"$id": "http://www.phpbu.de/phpbu.schema.json",
4+
"title": "PHPBU Configuration schema",
5+
"type": "object",
6+
"required": [
7+
"verbose",
8+
"logging",
9+
"backups"
10+
],
11+
"properties": {
12+
"verbose": {
13+
"$id": "#root/verbose",
14+
"title": "Controls the output verbosity",
15+
"type": "boolean",
16+
"examples": [
17+
true
18+
],
19+
"default": false
20+
},
21+
"logging": {
22+
"$id": "#root/logging",
23+
"title": "Logging",
24+
"type": "array",
25+
"default": [],
26+
"items": {
27+
"$id": "#root/logging/items",
28+
"title": "Controls where output is logged",
29+
"type": "object",
30+
"required": [
31+
"type",
32+
"target"
33+
],
34+
"properties": {
35+
"type": {
36+
"$id": "#root/logging/items/type",
37+
"title": "Type indicates where stuff is logged",
38+
"type": "string",
39+
"default": "",
40+
"examples": [
41+
"Json"
42+
],
43+
"enum": [
44+
"Json",
45+
"Mail",
46+
"Webhook",
47+
"Telegram",
48+
"Prometheus"
49+
]
50+
},
51+
"target": {
52+
"$id": "#root/logging/items/target",
53+
"title": "Target, format depends on log type",
54+
"type": "string",
55+
"default": "",
56+
"examples": [
57+
"/tmp/backup.log.json"
58+
],
59+
"pattern": "^.*$"
60+
}
61+
}
62+
}
63+
},
64+
"backups": {
65+
"$id": "#root/backups",
66+
"title": "A backup of a project might consist of several specific backups (database, files, ...)",
67+
"type": "array",
68+
"default": [],
69+
"items": {
70+
"$id": "#root/backups/items",
71+
"title": "A specific backup",
72+
"type": "object",
73+
"required": [
74+
"name",
75+
"source",
76+
"target"
77+
],
78+
"properties": {
79+
"name": {
80+
"$id": "#root/backups/items/name",
81+
"title": "Name",
82+
"type": "string",
83+
"default": "",
84+
"examples": [
85+
"Database backup"
86+
],
87+
"pattern": "^.*$"
88+
},
89+
"source": {
90+
"$id": "#root/backups/items/source",
91+
"title": "Source",
92+
"type": "object",
93+
"required": [
94+
"type",
95+
"options"
96+
],
97+
"properties": {
98+
"type": {
99+
"$id": "#root/backups/items/source/type",
100+
"title": "Type",
101+
"type": "string",
102+
"default": "",
103+
"examples": [
104+
"Tar"
105+
],
106+
"enum": [
107+
"ArangoDump",
108+
"ElasticDump",
109+
"MongoDump",
110+
"MysqlDump",
111+
"PgDump",
112+
"InfluxDump",
113+
"LdapDump",
114+
"Redis",
115+
"RSync",
116+
"Tar",
117+
"XtraBackup"
118+
]
119+
},
120+
"options": {
121+
"$id": "#root/backups/items/source/options",
122+
"title": "Options for the source, content depends on type",
123+
"type": "object"
124+
}
125+
}
126+
},
127+
"target": {
128+
"$id": "#root/backups/items/target",
129+
"title": "Target",
130+
"type": "object",
131+
"required": [
132+
"dirname",
133+
"filename"
134+
],
135+
"properties": {
136+
"dirname": {
137+
"$id": "#root/backups/items/target/dirname",
138+
"title": "Path to the directory where the backup is stored, absolute or relative to the config file.",
139+
"type": "string",
140+
"default": "",
141+
"examples": [
142+
"/tmp"
143+
],
144+
"pattern": "^.*$"
145+
},
146+
"filename": {
147+
"$id": "#root/backups/items/target/filename",
148+
"title": "Filename of output, might contain placeholders, see https://www.php.net/manual/en/function.date.php for possible values",
149+
"type": "string",
150+
"default": "",
151+
"examples": [
152+
"backup-%Y%m%d-%H%i.sql"
153+
],
154+
"pattern": "^.*$"
155+
},
156+
"compress": {
157+
"$id": "#root/backups/items/target/compress",
158+
"title": "The type of compression to use",
159+
"type": "string",
160+
"default": "",
161+
"examples": [
162+
"bzip2"
163+
],
164+
"enum": [
165+
"bzip2",
166+
"gzip",
167+
"zip",
168+
"7zip",
169+
"xz"
170+
]
171+
}
172+
}
173+
},
174+
"checks": {
175+
"$id": "#root/backups/items/checks",
176+
"title": "Checks applied to created backups",
177+
"type": "array",
178+
"default": [],
179+
"items": {
180+
"$id": "#root/backups/items/checks/items",
181+
"title": "A specific check",
182+
"type": "object",
183+
"required": [
184+
"type",
185+
"value"
186+
],
187+
"properties": {
188+
"type": {
189+
"$id": "#root/backups/items/checks/items/type",
190+
"title": "The type of check",
191+
"type": "string",
192+
"default": "",
193+
"examples": [
194+
"SizeMin"
195+
],
196+
"enum": [
197+
"SizeMin",
198+
"SizeDiffPreviousPercent",
199+
"SizeDiffAvgPercent"
200+
]
201+
},
202+
"value": {
203+
"$id": "#root/backups/items/checks/items/value",
204+
"title": "The value for the check, p.ex. 500k for sizemin or 10 for 10% maximum size difference",
205+
"type": "string",
206+
"default": "",
207+
"examples": [
208+
"50M"
209+
],
210+
"pattern": "^.*$"
211+
}
212+
}
213+
}
214+
},
215+
"crypt": {
216+
"$id": "#root/backups/items/crypt",
217+
"title": "Specifies what type of encryption should be used to encrypt the backup.",
218+
"type": "object",
219+
"default": [],
220+
"properties": {
221+
"type": {
222+
"$id": "#root/backups/items/crypts/items/type",
223+
"title": "The type of sync",
224+
"type": "string",
225+
"default": "",
226+
"examples": [
227+
"gpg"
228+
],
229+
"enum": [
230+
"gpg",
231+
"mcrypt",
232+
"openssl"
233+
]
234+
},
235+
"skipOnFailure": {
236+
"$id": "#root/backups/items/crypts/items/value",
237+
"title": "You can still execute the crypt, even if failure(s) occurred.",
238+
"type": "boolean",
239+
"default": "false",
240+
"examples": [
241+
"true"
242+
]
243+
},
244+
"options": {
245+
"$id": "#root/backups/items/crypts/items/options",
246+
"title": "The options, content depends on crypt type",
247+
"type": "object"
248+
}
249+
}
250+
},
251+
"syncs": {
252+
"$id": "#root/backups/items/syncs",
253+
"title": "Syncs allow for finished backups to be synced to some other location",
254+
"type": "array",
255+
"default": [],
256+
"items": {
257+
"$id": "#root/backups/items/syncs/items",
258+
"title": "A specific sync",
259+
"type": "object",
260+
"required": [
261+
"type"
262+
],
263+
"properties": {
264+
"type": {
265+
"$id": "#root/backups/items/syncs/items/type",
266+
"title": "The type of sync",
267+
"type": "string",
268+
"default": "",
269+
"examples": [
270+
"rsync"
271+
],
272+
"enum": [
273+
"Amazons3",
274+
"Amazons3-v3",
275+
"Amazons3-v2",
276+
"Backblazes3",
277+
"Azureblob",
278+
"Dropbox",
279+
"Ftp",
280+
"GoogleDrive",
281+
"RSync",
282+
"Sftp",
283+
"Softlayer",
284+
"Openstack",
285+
"Yandex-disk"
286+
]
287+
},
288+
"skipOnFailure": {
289+
"$id": "#root/backups/items/checks/items/value",
290+
"title": "You can still execute the sync, even if failure(s) occurred.",
291+
"type": "boolean",
292+
"default": "false",
293+
"examples": [
294+
"true"
295+
]
296+
},
297+
"options": {
298+
"$id": "#root/backups/items/syncs/items/options",
299+
"title": "The options, content depends on sync type",
300+
"type": "object"
301+
}
302+
}
303+
}
304+
},
305+
"cleanup": {
306+
"$id": "#root/backups/items/cleanup",
307+
"title": "Tells phpbu which files to delete after a successful backup",
308+
"type": "object",
309+
"required": [
310+
"type",
311+
"options"
312+
],
313+
"properties": {
314+
"type": {
315+
"$id": "#root/backups/items/cleanup/type",
316+
"title": "Type",
317+
"type": "string",
318+
"default": "",
319+
"examples": [
320+
"quantity"
321+
],
322+
"enum": [
323+
"capacity",
324+
"outdated",
325+
"stepwise",
326+
"quantity"
327+
]
328+
},
329+
"options": {
330+
"$id": "#root/backups/items/cleanup/options",
331+
"title": "Depend on cleanup type",
332+
"type": "object"
333+
}
334+
}
335+
}
336+
}
337+
}
338+
}
339+
}
340+
}

0 commit comments

Comments
 (0)