aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/DataConfig.groovy17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/DataConfig.groovy b/src/DataConfig.groovy
index f22c23c..666360c 100644
--- a/src/DataConfig.groovy
+++ b/src/DataConfig.groovy
@@ -5,13 +5,28 @@ class DataConfig implements Serializable {
String root = '.'
String server_id = ''
String match_prefix = '(.*)'
+ String direction
Boolean managed = true
Boolean keep_data = false
int keep_builds = 20
int keep_days = 10
def data = [:]
- DataConfig() {}
+ DataConfig(String direction = "upload") {
+ this.direction = direction.toLowerCase()
+ if (!this.isUpload() && !this.isDownload()) {
+ throw new Exception("DataConfig.direction argument must be 'upload'"
+ + "or 'download' (got: ${this.direction})")
+ }
+ }
+
+ def isUpload() {
+ return this.direction.startsWith('u')
+ }
+
+ def isDownload() {
+ return this.direction.startswith('d')
+ }
def insert(String name, String block) {
/* Store JSON directly as string */