Factorise var
This commit is contained in:
parent
cc18e8f8de
commit
b81b550b0a
47
.env
47
.env
|
@ -1,3 +1,50 @@
|
||||||
### Variables d'environnement
|
### Variables d'environnement
|
||||||
|
|
||||||
LOG_FILE="/tmp/g1sms.log"
|
LOG_FILE="/tmp/g1sms.log"
|
||||||
|
|
||||||
|
export YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
||||||
|
export CHEMIN="/home/$YOU/G1sms+"
|
||||||
|
cd $CHEMIN
|
||||||
|
##################################################################
|
||||||
|
# Activate logging to /tmp/g1sms.log (YES/NO)
|
||||||
|
export DOLOG="YES"
|
||||||
|
export CPERROR="NOYES"
|
||||||
|
##################################################################
|
||||||
|
# Country Node Phone international prefix (TODO Worldwide)
|
||||||
|
export COUNTRY="+33"
|
||||||
|
##################################################################
|
||||||
|
# DU has a G1 value changed every 6 month!
|
||||||
|
# ./_DU Updated by cron_CODE.backup.sh
|
||||||
|
if [[ -f "./_DU" ]]; then export DUFACTOR=$(bc <<< "scale=2; $(cat "./_DU") / 100"); else log "__SUB:init.sh: FAILING TO FIND ./_DU EXIT!!!"; exit; fi
|
||||||
|
##################################################################
|
||||||
|
# Choose Default Unit: G1, DU, LOVE (DU cents), ZEN (G1 cents)
|
||||||
|
export COIN="G1"
|
||||||
|
##################################################################
|
||||||
|
# Limit and commission values
|
||||||
|
export LIMIT=2 # Solde minimum = 2 G1
|
||||||
|
# FIXED COMMISSION SYSTEM
|
||||||
|
export COMMISSION=1 # transaction commission amount (G1)
|
||||||
|
export BILLCOM=20
|
||||||
|
##################################################################
|
||||||
|
# COMMISSION PARTS FROM TX FOR NODE & G1SMS NETWORK
|
||||||
|
# PART COMMISSION SYSTEM
|
||||||
|
export SWARMCOMM=10
|
||||||
|
# TODO: NODE G1sms Wallet can receive rewards from SWARM or WALLETS/FILES
|
||||||
|
export NODECOMM=10
|
||||||
|
##################################################################
|
||||||
|
# SMS SIM Card Phone Number
|
||||||
|
export MASTERPHONE="+33660780131"
|
||||||
|
export ADRESSE="au G1FabLab de Toulouse"
|
||||||
|
export G1DAB="NO"
|
||||||
|
##################################################################
|
||||||
|
# ADMIN COMMAND PHONE ORIGIN
|
||||||
|
export ADMINPHONE="+33647683646"
|
||||||
|
export ADMINPSEUDO="Fred"
|
||||||
|
##################################################################
|
||||||
|
# DUNITER/CESIUM+ DEFAULT SERVERS
|
||||||
|
export DUNITER="https://g1.duniter.org"
|
||||||
|
export CESIUM="https://g1.data.le-sou.org"
|
||||||
|
|
||||||
|
# TODO Use latest Silkaj from "sudo pip3 install silkaj"
|
||||||
|
# export SILKAJ="/usr/local/bin/silkaj"
|
||||||
|
source $CHEMIN/shell/init_keys.sh
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
import sys
|
import sys
|
||||||
from duniterpy.key import SigningKey
|
from duniterpy.key import SigningKey
|
||||||
|
|
||||||
|
|
||||||
def generate_public_key(salt: str, password: str) -> str:
|
def generate_public_key(salt: str, password: str) -> str:
|
||||||
"""
|
"""
|
||||||
Return public key from credentials
|
Return public key from credentials
|
||||||
|
@ -39,4 +38,3 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
# exit with status code ok
|
# exit with status code ok
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,13 @@ function log () {
|
||||||
# log ($1=text)
|
# log ($1=text)
|
||||||
if [ "$DOLOG" == "YES" ]
|
if [ "$DOLOG" == "YES" ]
|
||||||
then
|
then
|
||||||
echo "$PHONE:$1" >> /tmp/g1sms.log
|
echo "$PHONE:$1" >> $LOG_FILE
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
### Déclaration de l'environnement
|
||||||
|
source .env
|
||||||
|
|
||||||
###################################################################################################################################
|
|
||||||
fn_exists() {
|
fn_exists() {
|
||||||
# appended double quote is an ugly trick to make sure we do get a string -- if $1 is not a known command, type does not output anything
|
# appended double quote is an ugly trick to make sure we do get a string -- if $1 is not a known command, type does not output anything
|
||||||
[ `type -t $1`"" == 'file' ]
|
[ `type -t $1`"" == 'file' ]
|
||||||
|
@ -28,49 +29,3 @@ function gammu-smsd-inject () {
|
||||||
else
|
else
|
||||||
export G1SMS="YES"
|
export G1SMS="YES"
|
||||||
fi
|
fi
|
||||||
export YOU=$(ps aux --sort=+utime | grep ipfs | tail -n 1 | cut -d " " -f 1)
|
|
||||||
export CHEMIN="/home/$YOU/G1sms+"
|
|
||||||
cd $CHEMIN
|
|
||||||
##################################################################
|
|
||||||
# Activate logging to /tmp/g1sms.log (YES/NO)
|
|
||||||
export DOLOG="YES"
|
|
||||||
export CPERROR="NOYES"
|
|
||||||
##################################################################
|
|
||||||
# Country Node Phone international prefix (TODO Worldwide)
|
|
||||||
export COUNTRY="+33"
|
|
||||||
##################################################################
|
|
||||||
# DU has a G1 value changed every 6 month!
|
|
||||||
# ./_DU Updated by cron_CODE.backup.sh
|
|
||||||
if [[ -f "./_DU" ]]; then export DUFACTOR=$(bc <<< "scale=2; $(cat "./_DU") / 100"); else log "__SUB:init.sh: FAILING TO FIND ./_DU EXIT!!!"; exit; fi
|
|
||||||
##################################################################
|
|
||||||
# Choose Default Unit: G1, DU, LOVE (DU cents), ZEN (G1 cents)
|
|
||||||
export COIN="G1"
|
|
||||||
##################################################################
|
|
||||||
# Limit and commission values
|
|
||||||
export LIMIT=2 # Solde minimum = 2 G1
|
|
||||||
# FIXED COMMISSION SYSTEM
|
|
||||||
export COMMISSION=1 # transaction commission amount (G1)
|
|
||||||
export BILLCOM=20
|
|
||||||
##################################################################
|
|
||||||
# COMMISSION PARTS FROM TX FOR NODE & G1SMS NETWORK
|
|
||||||
# PART COMMISSION SYSTEM
|
|
||||||
export SWARMCOMM=10
|
|
||||||
# TODO: NODE G1sms Wallet can receive rewards from SWARM or WALLETS/FILES
|
|
||||||
export NODECOMM=10
|
|
||||||
##################################################################
|
|
||||||
# SMS SIM Card Phone Number
|
|
||||||
export MASTERPHONE="+33660780131"
|
|
||||||
export ADRESSE="au G1FabLab de Toulouse"
|
|
||||||
export G1DAB="NO"
|
|
||||||
##################################################################
|
|
||||||
# ADMIN COMMAND PHONE ORIGIN
|
|
||||||
export ADMINPHONE="+33647683646"
|
|
||||||
export ADMINPSEUDO="Fred"
|
|
||||||
##################################################################
|
|
||||||
# DUNITER/CESIUM+ DEFAULT SERVERS
|
|
||||||
export DUNITER="https://g1.duniter.org"
|
|
||||||
export CESIUM="https://g1.data.le-sou.org"
|
|
||||||
|
|
||||||
# TODO Use latest Silkaj from "sudo pip3 install silkaj"
|
|
||||||
# export SILKAJ="/usr/local/bin/silkaj"
|
|
||||||
source $CHEMIN/shell/init_keys.sh
|
|
||||||
|
|
|
@ -206,4 +206,3 @@ if [[ "$PHONE" != "$ADMINPHONE" && "$CPERROR" == "YES" ]]; then sms_SEND "$ADMIN
|
||||||
|
|
||||||
echo $PUBKEY
|
echo $PUBKEY
|
||||||
exit
|
exit
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue