redis-server ${REDIS_CONF} || die "Error starting redis"
echo "Redis successfully started on port ${port}"
}
function stop_redis() {
port=$(redis_port)
REDIS_DIR=/tmp/redis-${port}
function stop_redis_by_dir() {
REDIS_DIR=${1}
PID_FILE=${REDIS_DIR}/redis.pid
if [[ ! -f ${PID_FILE} ]] ; then
echo "Redis pid file not found: ${PID_FILE}"
@@ -45,26 +43,44 @@ function stop_redis() {
kill $(cat ${PID_FILE}) || die "Error killing redis using pid file: ${PID_FILE}"
fi
echo "Removing redis dir: ${REDIS_DIR}"
rm -rf ${REDIS_DIR} || die "Error removing redis dir: ${REDIS_DIR}"
if [[ -d ${REDIS_DIR} ]] ; then
echo "Removing redis dir: ${REDIS_DIR}"
rm -rf ${REDIS_DIR} || die "Error removing redis dir: ${REDIS_DIR}"
fi
}
function stop_redis() {
port=$(redis_port)
REDIS_DIR=/tmp/redis-${port}
stop_redis_by_dir ${REDIS_DIR}
}
echo "Redis stopped and cleaned up"
function redis_clean() {
for REDIS_DIR in $(find /tmp -maxdepth 1 -type d -name "redis-*") ; do
stop_redis_by_dir ${REDIS_DIR}
done
}
if [[ -z ${1} ]] ; then
die "expected one of: start stop port"
die "expected one of: start stop clean port"
fi
case ${1} in
"start")
stop_redis
start_redis
echo "Redis successfully started"
;;
"stop")
stop_redis
echo "Redis stopped and cleaned up"
;;
"port")
redis_port
;;
"clean")
redis_clean
;;
*)
die "invalid argument: ${1}"
;;
+ 11- 1
bubble-server/src/main/java/bubble/ApiConstants.javaZobrazit soubor
@@ -76,7 +76,17 @@ public class ApiConstants {
public static final GoogleAuthenticator G_AUTH = new GoogleAuthenticator();
public static final Predicate ALWAYS_TRUE = m -> true;
public static final String HOME_DIR = System.getProperty("user.home");
public static final String HOME_DIR;
static {
final String userHome = System.getProperty("user.home");
final String envHome = System.getenv("HOME");
if (!userHome.equals(envHome)) {
log.warn("System.getProperty(\"user.home\") == "+userHome+" differs from System.getenv(\"HOME\") == "+envHome+", using HOME from environment: "+envHome);
HOME_DIR = envHome;
} else {
HOME_DIR = userHome;
}
}
public static final File CACERTS_DIR = new File(HOME_DIR, "cacerts");
public static final File MITMPROXY_CERT_DIR = new File(HOME_DIR, "mitm_certs");
+ 3- 2
bubble-server/src/main/java/bubble/cloud/storage/local/LocalStorageDriver.javaZobrazit soubor