# Sourced by every dev-*.sh: the port, the zone, the state directory and the # certificate authority the development stack runs on, unless the environment # already says otherwise. # # Not executable, and not a command anyone runs. This is the one place these # defaults are written down, so the scripts agree with each other and a # second stack on one machine is a second set of these in the environment: # # DIDBOT_PDS_PORT=3100 DIDBOT_ZONE=beta.localhost ./scripts/dev-pds.sh # # A variable already set wins, and set includes set to nothing. That is why # the state directory is spelled `${NAME-value}` rather than `${NAME:-value}`: # `DIDBOT_PDS_DATA= ./scripts/dev-pds.sh` is how a run asks for a store in # memory, and the `:-` form would hand the default straight back. # # The server always serves TLS. docs/running-locally.md has the two one-time # steps a machine needs before any of this reaches it: trusting the authority # below, and letting the binary bind 443. export DIDBOT_PDS_PORT="${DIDBOT_PDS_PORT:-443}" export DIDBOT_ZONE="${DIDBOT_ZONE:-agents.localhost}" export DIDBOT_PDS_DATA="${DIDBOT_PDS_DATA-${XDG_STATE_HOME:-$HOME/.local/state}/didbot/pds}" # One certificate authority per machine, signed once and trusted once. Two # checkouts pointed at one directory share it; pointed at two, they do not. export DIDBOT_LOCAL_CA="${DIDBOT_LOCAL_CA:-${XDG_STATE_HOME:-$HOME/.local/state}/didbot/local-ca}" # The Rust tools and the Node ones each read their own variable, and both # mean the same file: trust this authority on top of the built-in roots. export DIDBOT_EXTRA_CA_CERTS="${DIDBOT_EXTRA_CA_CERTS:-$DIDBOT_LOCAL_CA/ca.pem}" export NODE_EXTRA_CA_CERTS="${NODE_EXTRA_CA_CERTS:-$DIDBOT_LOCAL_CA/ca.pem}" # A `did:web` carries no port, so an account resolves on 443. A stack on any # other port says where its zone answers, and every tool here resolves # accordingly; a browser is told the same thing with its own resolver rules. if [ "$DIDBOT_PDS_PORT" != "443" ]; then export DIDBOT_RESOLVE_PORTS="${DIDBOT_RESOLVE_PORTS:-${DIDBOT_ZONE}=${DIDBOT_PDS_PORT}}" fi # Where everything reaches the server. A URL with no port in it means 443, # which is what a stack that took 443 should be addressed as. if [ "$DIDBOT_PDS_PORT" = "443" ]; then export DIDBOT_PDS_ORIGIN="${DIDBOT_PDS_ORIGIN:-https://${DIDBOT_ZONE}}" else export DIDBOT_PDS_ORIGIN="${DIDBOT_PDS_ORIGIN:-https://${DIDBOT_ZONE}:${DIDBOT_PDS_PORT}}" fi