mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-24 12:46:45 +00:00
add file flag fallback to set testnet on startup
This commit is contained in:
parent
bda5c1a709
commit
194f0f5c1b
3 changed files with 9 additions and 1 deletions
|
@ -52,6 +52,8 @@ As a fallback, the network (mainnet, testnet or regtest) can also be set using a
|
||||||
|
|
||||||
`export SPARROW_NETWORK=testnet`
|
`export SPARROW_NETWORK=testnet`
|
||||||
|
|
||||||
|
A final fallback which can be useful when running the Sparrow binary is to create a file called ``network-testnet`` in the Sparrow home folder (see below) to configure the testnet network.
|
||||||
|
|
||||||
Note that if you are connecting to an Electrum server when using testnet, that server will need to running on testnet configuration as well.
|
Note that if you are connecting to an Electrum server when using testnet, that server will need to running on testnet configuration as well.
|
||||||
|
|
||||||
When not explicitly configured using the command line argument above, Sparrow stores it's mainnet config file, log file and wallets in a home folder location appropriate to the operating system:
|
When not explicitly configured using the command line argument above, Sparrow stores it's mainnet config file, log file and wallets in a home folder location appropriate to the operating system:
|
||||||
|
|
|
@ -8,6 +8,7 @@ import com.sparrowwallet.sparrow.glyphfont.FontAwesome5Brands;
|
||||||
import com.sparrowwallet.sparrow.io.Config;
|
import com.sparrowwallet.sparrow.io.Config;
|
||||||
import com.sparrowwallet.sparrow.io.FileType;
|
import com.sparrowwallet.sparrow.io.FileType;
|
||||||
import com.sparrowwallet.sparrow.io.IOUtils;
|
import com.sparrowwallet.sparrow.io.IOUtils;
|
||||||
|
import com.sparrowwallet.sparrow.io.Storage;
|
||||||
import com.sparrowwallet.sparrow.preferences.PreferenceGroup;
|
import com.sparrowwallet.sparrow.preferences.PreferenceGroup;
|
||||||
import com.sparrowwallet.sparrow.preferences.PreferencesDialog;
|
import com.sparrowwallet.sparrow.preferences.PreferencesDialog;
|
||||||
import javafx.application.Application;
|
import javafx.application.Application;
|
||||||
|
@ -138,6 +139,11 @@ public class MainApp extends Application {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File testnetFlag = new File(Storage.getSparrowHome(), "network-" + Network.TESTNET.getName());
|
||||||
|
if(testnetFlag.exists()) {
|
||||||
|
Network.set(Network.TESTNET);
|
||||||
|
}
|
||||||
|
|
||||||
if(Network.get() != Network.MAINNET) {
|
if(Network.get() != Network.MAINNET) {
|
||||||
log.info("Using " + Network.get() + " configuration");
|
log.info("Using " + Network.get() + " configuration");
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,7 +285,7 @@ public class Storage {
|
||||||
return getSparrowHome();
|
return getSparrowHome();
|
||||||
}
|
}
|
||||||
|
|
||||||
static File getSparrowHome() {
|
public static File getSparrowHome() {
|
||||||
if(System.getProperty(MainApp.APP_HOME_PROPERTY) != null) {
|
if(System.getProperty(MainApp.APP_HOME_PROPERTY) != null) {
|
||||||
return new File(System.getProperty(MainApp.APP_HOME_PROPERTY));
|
return new File(System.getProperty(MainApp.APP_HOME_PROPERTY));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue