blob: d9726c88e4c68746ec4d87308892a337eff30c42 (
plain) (
blame)
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
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.node.admin.nodeadmin;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.File;
import java.io.IOException;
import java.util.logging.Logger;
@JsonIgnoreProperties(ignoreUnknown = true)
public class NodeAdminConfig {
private static final Logger logger = Logger.getLogger(NodeAdminConfig.class.getName());
private static final ObjectMapper mapper = new ObjectMapper();
public enum Mode {
aws_tenant,
config_server_host,
tenant,
}
@JsonProperty("mode")
public Mode mode = Mode.tenant;
@JsonProperty("docker")
public DockerAdminConfig docker = new DockerAdminConfig();
public static NodeAdminConfig fromFile(File file) {
if (!file.exists()) {
return new NodeAdminConfig();
}
try {
return mapper.readValue(file, NodeAdminConfig.class);
} catch (IOException e) {
throw new RuntimeException("Failed to read " + file + " as a " +
NodeAdminConfig.class.getName(), e);
}
}
}
|