blob: 0b6d1ffd10553986fbff1656e6d2f4c3891f6dad [file] [log] [blame]
/**
******************************************************************************
* Copyright © 2018 PTA GmbH.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
*
* http://www.eclipse.org/legal/epl-v10.html
*
******************************************************************************
*/
package org.eclipse.openk.mics.home.common;
import org.eclipse.openk.mics.home.common.util.ResourceLoaderBase;
public class BackendConfig {
private static String configFileName = "backendConfigDevLocal.json";
// properties of the configfile
private String micsCentralURL;
private String micsDistributionCluster;
private String micsHealthStateExtraPath;
private boolean micsCentralIsHttps;
private static BackendConfig instance;
private BackendConfig() {
}
public static synchronized BackendConfig getInstance() {
if (instance == null) {
String jsonConfig = loadJsonConfig();
instance = JsonGeneratorBase.getGson().fromJson(jsonConfig, BackendConfig.class);
}
return instance;
}
private static String loadJsonConfig() {
ResourceLoaderBase resourceLoaderBase = new ResourceLoaderBase();
return resourceLoaderBase.loadStringFromResource(configFileName);
}
public String getMicsCentralURL() {
return micsCentralURL;
}
public String getMicsDistributionCluster() {
return micsDistributionCluster;
}
public String getMicsHealthStateExtraPath() {
return micsHealthStateExtraPath;
}
public boolean isMicsCentralIsHttps() {
return micsCentralIsHttps;
}
public static String getConfigFileName() {
return configFileName;
}
public static void setConfigFileName(String configFileName) {
BackendConfig.configFileName = configFileName;
}
}