mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-20 04:44:30 -04:00
Add config file support for network type selection
This commit is contained in:
parent
d2b1c5f37c
commit
a5a04fe72c
6 changed files with 104 additions and 10 deletions
57
src/main/java/io/bitsquare/util/ConfigLoader.java
Normal file
57
src/main/java/io/bitsquare/util/ConfigLoader.java
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* This file is part of Bitsquare.
|
||||
*
|
||||
* Bitsquare is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Bitsquare is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Bitsquare. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package io.bitsquare.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import lighthouse.files.AppDirectory;
|
||||
|
||||
public class ConfigLoader {
|
||||
private static final Logger log = LoggerFactory.getLogger(ConfigLoader.class);
|
||||
private static final String configFilePath = AppDirectory.dir() + "/bitsquare.config";
|
||||
|
||||
public static Properties loadConfig() {
|
||||
Properties properties = new Properties();
|
||||
InputStream inputStream = null;
|
||||
if (new File(configFilePath).exists()) {
|
||||
try {
|
||||
inputStream = new FileInputStream(configFilePath);
|
||||
properties.load(inputStream);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e2) {
|
||||
e2.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue