Update run script to allow editing config file on restart
This commit is contained in:
parent
4e083cec49
commit
88c7911af3
@ -13,20 +13,30 @@ TMKMS_STATE_DIR=$TMKMS_HOME/state
|
||||
|
||||
# Check if priv_validator_key in SECRETS_DIR exists
|
||||
if [[ ! -f "$TMKMS_SECRETS_DIR/priv_validator_key" ]]; then
|
||||
|
||||
# Initialize tmkms config
|
||||
echo "Initializing tmkms configuration..."
|
||||
tmkms init $TMKMS_HOME
|
||||
|
||||
# Generate a new softsign key
|
||||
echo "Generating new softsign key..."
|
||||
tmkms softsign keygen $TMKMS_SECRETS_DIR/kms-identity.key
|
||||
# Import the private validator key into tmkms
|
||||
echo "Importing private validator key into tmkms..."
|
||||
tmkms softsign import $INPUT_PRIV_KEY_FILE $TMKMS_SECRETS_DIR/priv_validator_key
|
||||
|
||||
# Update tmkms.toml
|
||||
echo "Updating tmkms.toml with chain_id, node IP, and key prefixes..."
|
||||
# Remove the original private validator key
|
||||
rm -rf $INPUT_PRIV_KEY_FILE
|
||||
|
||||
# Add chain configuration
|
||||
cat <<EOF > $TMKMS_HOME/tmkms.toml
|
||||
else
|
||||
echo "tmkms configuration already exists. Skipping initialization and cleaning up any existing input private validator key files..."
|
||||
# Remove the original private validator key as it is not needed
|
||||
if [[ -f "$INPUT_PRIV_KEY_FILE" ]]; then
|
||||
rm -rf $INPUT_PRIV_KEY_FILE
|
||||
fi
|
||||
fi
|
||||
|
||||
# Update tmkms.toml
|
||||
echo "Updating tmkms.toml with chain_id, node IP, and key prefixes..."
|
||||
|
||||
# Add chain configuration
|
||||
cat <<EOF > $TMKMS_HOME/tmkms.toml
|
||||
|
||||
[[chain]]
|
||||
id = "$CHAIN_ID"
|
||||
@ -46,21 +56,5 @@ if [[ ! -f "$TMKMS_SECRETS_DIR/priv_validator_key" ]]; then
|
||||
chain_ids = ["$CHAIN_ID"]
|
||||
EOF
|
||||
|
||||
# Import the private validator key into tmkms
|
||||
echo "Importing private validator key into tmkms..."
|
||||
tmkms softsign import $INPUT_PRIV_KEY_FILE $TMKMS_SECRETS_DIR/priv_validator_key
|
||||
|
||||
# Remove the original private validator key
|
||||
rm -rf $INPUT_PRIV_KEY_FILE
|
||||
|
||||
else
|
||||
echo "tmkms configuration already exists. Skipping initialization..."
|
||||
# Throw error if tmp/priv_validator_key.json exists
|
||||
if [[ -f "$INPUT_PRIV_KEY_FILE" ]]; then
|
||||
echo "ERROR: $INPUT_PRIV_KEY_FILE already exists. Please remove it and try again."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Starting tmkms..."
|
||||
tmkms start --config $TMKMS_HOME/tmkms.toml
|
||||
|
Loading…
Reference in New Issue
Block a user