Merge pull request 'Add support for CWTCH_DIR env var' (#101) from cwtchDirEnv into trunk
continuous-integration/drone/push Build is passing Details

Reviewed-on: #101
Reviewed-by: Sarah Jamie Lewis <sarah@openprivacy.ca>
This commit is contained in:
Sarah Jamie Lewis 2021-07-08 13:27:41 -07:00
commit f4b4458d4c
3 changed files with 8 additions and 5 deletions

View File

@ -1 +1 @@
v1.0.0-25-g801a805-2021-07-07-16-10
v1.0.0-27-g4d218df-2021-07-07-23-27

View File

@ -11,10 +11,12 @@ This README covers build instructions, for information on Cwtch itself please go
- Linux: Available from [https://cwtch.im/download/](https://cwtch.im/download/) as a .tar.gz
- `install.home.sh` installs the app into your home directory
- `install.sys.sh` as root to install system wide
- or run out of the unziped directory
## Running
Cwtch logging is controlable with the following environment variables:
Cwtch processes the following environment variables:
- `CWTCH_HOME=` overrides the default storage path of `~/.cwtch` with what ever you choose
- `LOG_FILE=` will reroute all of libcwtch-go's logging to the specified file instead of the console
- `LOG_LEVEL=debug` will set the log level to debug instead of info

View File

@ -89,7 +89,7 @@ class CwtchFfi implements Cwtch {
String bundledTor = "";
Map<String, String> envVars = Platform.environment;
if (Platform.isLinux) {
home = (envVars['HOME'])!;
home = envVars['HOME']!;
if (await File("linux/tor").exists()) {
bundledTor = "linux/tor";
} else if (await File("lib/tor").exists()) {
@ -102,10 +102,11 @@ class CwtchFfi implements Cwtch {
bundledTor = "tor";
}
} else if (Platform.isWindows) {
home = (envVars['UserProfile'])!;
home = envVars['UserProfile']!;
bundledTor = "Tor\\Tor\\tor.exe";
}
var cwtchDir = path.join(home, ".cwtch");
var cwtchDir = envVars['CWTCH_HOME'] ?? path.join(home, ".cwtch");
if (EnvironmentConfig.BUILD_VER == dev_version) {
cwtchDir = path.join(cwtchDir, "dev");
}