StrausFuenf / hassio-addons

My homeassistant addons
Apache License 2.0
0 stars 1 forks source link

[Feature Request] Enable Data region selection in the Add-on config #12

Closed martymarty004 closed 8 months ago

martymarty004 commented 8 months ago

Since v1.30.2 it's now possible wo choose between US and EU servers for the push notification service.

As stated in the Wiki and in the relevant PR, if you want to change the server from the US default, you will need to specify the PUSH_RELAY_URI and PUSH_IDENTITY_URI environment variables as following:

EU Server :

- PUSH_RELAY_URI=https://push.bitwarden.eu
- PUSH_IDENTITY_URI=https://identity.bitwarden.eu

US Server (Default if not set) :

- PUSH_RELAY_URI=https://push.bitwarden.com
- PUSH_IDENTITY_URI=https://identity.bitwarden.com

You could implement a switch in the config to swap between the two servers (if false doesn't set the variable, which defaults to US), or simply add two more text input fields to allow customization of the variables (defaults to US if empty).

StrausFuenf commented 8 months ago

Added. Thanks for the request.

martymarty004 commented 8 months ago

You made a little mistake in the run script where you export the variables after the US/EU if statement, so it only works if the list is unset.

You exported ${push_relay} twice instead of ${push_identity_url} (line 105).

Here's the offending part:

# Find the matching log level                              <<-- This is probably a leftover from a copy/paste
if bashio::config.has_value 'push_server'; then
    case "$(bashio::string.lower "$(bashio::config 'push_server')")" in
        eu)
            push_relay="https://push.bitwarden.eu"
            push_identity_uri="https://identity.bitwarden.eu"
            ;;
        us)
            push_relay="https://push.bitwarden.com"
            push_identity_uri="https://identity.bitwarden.com"
            ;;
    esac

    export PUSH_RELAY_URI="${push_relay}"
    export PUSH_IDENTITY_URI="${push_relay}"    #  <<-- Here
fi

Obviously, this causes a misconfigured URL, but that's expected: image

StrausFuenf commented 8 months ago

Thanks. That happens if you implement stuff after a long workday. Its fixed in the development branch already. Need to test that and update the main branch later

StrausFuenf commented 8 months ago

You made a little mistake in the run script where you export the variables after the US/EU if statement, so it only works if the list is unset.

You exported ${push_relay} twice instead of ${push_identity_url} (line 105).

Here's the offending part:

# Find the matching log level                              <<-- This is probably a leftover from a copy/paste
if bashio::config.has_value 'push_server'; then
    case "$(bashio::string.lower "$(bashio::config 'push_server')")" in
        eu)
            push_relay="https://push.bitwarden.eu"
            push_identity_uri="https://identity.bitwarden.eu"
            ;;
        us)
            push_relay="https://push.bitwarden.com"
            push_identity_uri="https://identity.bitwarden.com"
            ;;
    esac

    export PUSH_RELAY_URI="${push_relay}"
    export PUSH_IDENTITY_URI="${push_relay}"    #  <<-- Here
fi

Obviously, this causes a misconfigured URL, but that's expected: image

Fixed now thanks again