Skip to content
Snippets Groups Projects
Select Git revision
  • 6365dc0e69e98eb071ee3bf4905874e7b85b7fea
  • main default protected
  • release/1.1
  • encrypt_comments
  • mnemonic_dewif
  • authors_rules
  • 0.14
  • rtd
  • 1.2.1 protected
  • 1.2.0 protected
  • 1.1.1 protected
  • 1.1.0 protected
  • 1.0.0 protected
  • 1.0.0rc1 protected
  • 1.0.0rc0 protected
  • 1.0.0-rc protected
  • 0.62.0 protected
  • 0.61.0 protected
  • 0.60.1 protected
  • 0.58.1 protected
  • 0.60.0 protected
  • 0.58.0 protected
  • 0.57.0 protected
  • 0.56.0 protected
  • 0.55.1 protected
  • 0.55.0 protected
  • 0.54.3 protected
  • 0.54.2 protected
28 results

send_certification.py

Blame
  • docker-entrypoint 2.42 KiB
    #!/bin/bash
    
    # Custom startup if a first argument is present and is equal to '--'
    # then we just run duniter with the provided arguments (but the '--')
    # without applying all the automated configuration below
    if [ "$1" = -- ]; then
      shift
      exec duniter "$@"
    fi
    
    # Normal startup
    function boolean () {
      echo "$1" | sed -E 's/^(true|yes|1)$/true/i'
    }
    
    function ternary () {
      if [ $(boolean "$1") = true ]; then
        echo "$2"
      else
        echo "$3"
      fi
    }
    
    DUNITER_NODE_NAME="${DUNITER_NODE_NAME:-$DUNITER_INSTANCE_NAME}"
    if [ -n "$DUNITER_NODE_NAME" ]; then
      set -- "$@" --name "$DUNITER_NODE_NAME"
    fi
    
    _DUNITER_KEY_FILE=/var/lib/duniter/node.key
    set -- "$@" --node-key-file "$_DUNITER_KEY_FILE"
    
    if [ ! -f "$_DUNITER_KEY_FILE" ]; then
      echo "Generating node key file '$_DUNITER_KEY_FILE'..."
      duniter key generate-node-key --file "$_DUNITER_KEY_FILE"
    else
      echo "Node key file '$_DUNITER_KEY_FILE' exists."
    fi
    _DUNITER_PEER_ID="$(duniter key inspect-node-key --file "$_DUNITER_KEY_FILE")"
    echo "Node peer ID is '$_DUNITER_PEER_ID'."
    
    if [ -n "$DUNITER_PUBLIC_ADDR" ]; then
      set -- "$@" --public-addr "$DUNITER_PUBLIC_ADDR"
    fi
    
    if [ -n "$DUNITER_LISTEN_ADDR" ]; then
      set -- "$@" --listen-addr "$DUNITER_LISTEN_ADDR"
    fi
    
    DUNITER_RPC_CORS="${DUNITER_RPC_CORS:-all}"
    set -- "$@" --rpc-cors "$DUNITER_RPC_CORS"
    
    DUNITER_VALIDATOR=$(boolean "${DUNITER_VALIDATOR:-false}")
    if [ "$DUNITER_VALIDATOR" = true ]; then
      set -- "$@" --rpc-methods Unsafe --validator
    fi
    
    DUNITER_DISABLE_PROMETHEUS=$(boolean "${DUNITER_DISABLE_PROMETHEUS:-false}")
    if [ "$DUNITER_DISABLE_PROMETHEUS" = true ]; then
      set -- "$@" --no-prometheus
    fi
    
    DUNITER_DISABLE_TELEMETRY=$(boolean "${DUNITER_DISABLE_TELEMETRY:-false}")
    if [ "$DUNITER_DISABLE_TELEMETRY" = true ]; then
      set -- "$@" --no-telemetry
    fi
    
    DUNITER_PRUNING_PROFILE="${DUNITER_PRUNING_PROFILE:-default}"
    case "$DUNITER_PRUNING_PROFILE" in
      default)
        ;;
      archive)
        set -- "$@" --state-pruning archive --blocks-pruning archive
        ;;
      light)
        set -- "$@" --blocks-pruning 14400
        ;;
      *)
        echo "ERROR: ignoring unknown DUNITER_PRUNING_PROFILE value '$DUNITER_PRUNING_PROFILE'" >&2
        ;;
    esac
    
    DUNITER_CHAIN_NAME="${DUNITER_CHAIN_NAME:-dev}"
    case "$DUNITER_CHAIN_NAME" in
      dev)
        chain=(--dev)
        ;;
      *)
        chain=(--chain "$DUNITER_CHAIN_NAME")
        ;;
    esac
    
    set -- "$@" \
      "${chain[@]}" \
      -d /var/lib/duniter --unsafe-rpc-external --unsafe-ws-external
    
    echo "Starting duniter with parameters:" "$@"
    exec duniter "$@"