#!/usr/bin/env bash
#
# Onionmine default params.
#
# Copyright (C) 2022 Silvio Rhatto <rhatto@torproject.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published
# by the Free Software Foundation, either version 3 of the License,
# or any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

# Parameters
#BASENAME="`basename $0`"
#DIRNAME="`dirname $0`"
BASEDIR="`cd $DIRNAME/.. &> /dev/null && pwd`"
ENV="$BASEDIR/onionmine.conf"
POOLS="$BASEDIR/pools"
CONFIG="$1"
POOL="$POOLS/$CONFIG"
FILTERS="$POOL/filters.lst"
CHECKPOINT="$POOL/checkpoint.save"
DATE="`date +%F-%H:%M:%S`"
LOGS="$POOL/logs"
LOG="$LOGS/$DATE.log"
CANDIDATES="$POOL/candidates"
DEPENDENCIES="gcc libsodium-dev make autoconf"
ENV_LOCAL="$POOL/local.conf"

# Default flags used for mkp224o compilation
MKP224O_BUILD_FLAGS="--enable-intfilter=native"

# Default flags used for mkp224o invocation
MKP224O_RUN_FLAGS="-s -d $CANDIDATES -f $FILTERS -B"

# Source the project-wide environment file
if [ -e "$ENV" ]; then
  source $ENV
fi

# Source the per-pool environment file
if [ ! -z "$CONFIG" ] && [ -e "$ENV_LOCAL" ]; then
  source $ENV_LOCAL
fi
