2 * Copyright (C) The Arvados Authors. All rights reserved.
4 * SPDX-License-Identifier: AGPL-3.0 OR Apache-2.0
8 package org.arvados.client.config;
10 import com.typesafe.config.Config;
11 import com.typesafe.config.ConfigFactory;
15 public class FileConfigProvider implements ConfigProvider {
17 private static final String DEFAULT_PATH = "arvados";
18 private final Config config;
20 public FileConfigProvider() {
21 config = ConfigFactory.load().getConfig(DEFAULT_PATH);
24 public FileConfigProvider(final String configFile) {
25 config = (configFile != null) ?
26 ConfigFactory.load(configFile).getConfig(DEFAULT_PATH) : ConfigFactory.load().getConfig(DEFAULT_PATH);
29 public Config getConfig() {
33 private File getFile(String path) {
34 return new File(config.getString(path));
37 private int getInt(String path) {
38 return config.getInt(path);
41 private boolean getBoolean(String path) {
42 return config.getBoolean(path);
45 private String getString(String path) {
46 return config.getString(path);
50 public boolean isApiHostInsecure() {
51 return this.getBoolean("api.host-insecure");
55 public String getKeepWebHost() {
56 return this.getString("api.keepweb-host");
60 public int getKeepWebPort() {
61 return this.getInt("api.keepweb-port");
65 public String getApiHost() {
66 return this.getString("api.host");
70 public int getApiPort() {
71 return this.getInt("api.port");
75 public String getApiToken() {
76 return this.getString("api.token");
80 public String getApiProtocol() {
81 return this.getString("api.protocol");
85 public int getFileSplitSize() {
86 return this.getInt("split-size");
90 public File getFileSplitDirectory() {
91 return this.getFile("temp-dir");
95 public int getNumberOfCopies() {
96 return this.getInt("copies");
100 public int getNumberOfRetries() {
101 return this.getInt("retries");
104 public String getIntegrationTestProjectUuid() {
105 return this.getString("integration-tests.project-uuid");
109 public int getConnectTimeout() {
110 return this.getInt("connectTimeout");
114 public int getReadTimeout() {
115 return this.getInt("readTimeout");
119 public int getWriteTimeout() {
120 return this.getInt("writeTimeout");