Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
Note that enabling network mode also requires setting `MAGPIE_NETWORK_INSTANCE_NAME` to a unique
name within the network.

Upgrading to this version does not require any database migration and if fully backwards compatible
with previous versions.

This change also introduces the ability to set
[all configuration options](https://pavics-magpie.readthedocs.io/en/latest/configuration.html#network-mode-settings)
for Magpie's network mode as environment variables in the local environment file.
Expand Down
15 changes: 12 additions & 3 deletions birdhouse/components/magpie/default.env
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,25 @@ export MAGPIE_WEBHOOKS_CONFIG_PATH="/opt/local/src/magpie/config/webhooks"

# Network mode settings. See for details:
# https://pavics-magpie.readthedocs.io/en/latest/configuration.html#network-mode-settings
#
# All of these are ignored unless MAGPIE_NETWORK_ENABLED is true
# MAGPIE_NETWORK_INSTANCE_NAME must be a unique name in the network (default is not set)
# MAGPIE_NETWORK_DEFAULT_TOKEN_EXPIRY and MAGPIE_NETWORK_INTERNAL_TOKEN_EXPIRY values are in seconds
# MAGPIE_NETWORK_PEM_FILES is a : separated list of files that are relative paths inside the MAGPIE_NETWORK_PEM_DIR directory
# MAGPIE_NETWORK_PEM_PASSWORDS is empty if no PEM files require passwords
# If at least one pem file requires a password then MAGPIE_NETWORK_PEM_PASSWORDS is a : separated list that is the same length
# as MAGPIE_NETWORK_PEM_FILES. For example if there are 4 files and only the first and third require passwords then this could
# be set to 'password1::password2:'
export MAGPIE_NETWORK_PEM_DIR='${BIRDHOUSE_DATA_PERSIST_ROOT}/magpie_pem'
export MAGPIE_NETWORK_ENABLED=false # Note: by default network mode is off (false)
export MAGPIE_NETWORK_INSTANCE_NAME= # Note: this must be a unique name in the network so no default is set
export MAGPIE_NETWORK_ENABLED=false
export MAGPIE_NETWORK_INSTANCE_NAME=
export MAGPIE_NETWORK_DEFAULT_TOKEN_EXPIRY=86400
export MAGPIE_NETWORK_INTERNAL_TOKEN_EXPIRY=30
export MAGPIE_NETWORK_TOKEN_NAME=magpie_token
export MAGPIE_NETWORK_PROVIDER=magpie_network
export MAGPIE_NETWORK_NAME_PREFIX=magpie_network_
export MAGPIE_NETWORK_GROUP_NAME=magpie_network
export MAGPIE_NETWORK_PEM_FILES=key.pem # These files must be relative paths from the MAGPIE_NETWORK_PEM_DIR directory
export MAGPIE_NETWORK_PEM_FILES=key.pem
export MAGPIE_NETWORK_PEM_PASSWORDS=
export MAGPIE_NETWORK_CREATE_MISSING_PEM_FILE=true

Expand Down
12 changes: 12 additions & 0 deletions birdhouse/components/magpie/pre-docker-compose-up.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env sh

if [ "$(echo "${MAGPIE_NETWORK_ENABLED}" | tr '[:upper:]' '[:lower:]')" = "true" ]; then
if [ -z "${MAGPIE_NETWORK_INSTANCE_NAME}" ]; then
log ERROR "MAGPIE_NETWORK_INSTANCE_NAME must be set when MAGPIE_NETWORK_ENABLED is true"
exit 1
fi
if [ -z "${MAGPIE_NETWORK_PEM_FILES}" ]; then
log ERROR "MAGPIE_NETWORK_PEM_FILES must be set when MAGPIE_NETWORK_ENABLED is true"
exit 1
fi
fi