mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-10-02 22:40:31 +00:00
add selection of data region for push
This commit is contained in:
parent
cbdcf8ef9f
commit
f8906c5575
3 changed files with 23 additions and 3 deletions
|
@ -80,8 +80,10 @@
|
|||
# PUSH_ENABLED=true
|
||||
# PUSH_INSTALLATION_ID=CHANGEME
|
||||
# PUSH_INSTALLATION_KEY=CHANGEME
|
||||
# PUSH_RELAY_REGION=us
|
||||
## Don't change this unless you know what you're doing.
|
||||
# PUSH_RELAY_URI=https://push.bitwarden.com
|
||||
# IDENTITY_URI=https://identity.bitwarden.com
|
||||
|
||||
## Controls whether users are allowed to create Bitwarden Sends.
|
||||
## This setting applies globally to all users.
|
||||
|
|
|
@ -50,7 +50,7 @@ async fn get_auth_push_token() -> ApiResult<String> {
|
|||
("client_secret", &client_secret),
|
||||
];
|
||||
|
||||
let res = match get_reqwest_client().post("https://identity.bitwarden.com/connect/token").form(¶ms).send().await
|
||||
let res = match get_reqwest_client().post(CONFIG.identity_uri()).form(¶ms).send().await
|
||||
{
|
||||
Ok(r) => r,
|
||||
Err(e) => err!(format!("Error getting push token from bitwarden server: {e}")),
|
||||
|
|
|
@ -380,8 +380,26 @@ make_config! {
|
|||
push {
|
||||
/// Enable push notifications
|
||||
push_enabled: bool, false, def, false;
|
||||
/// Push relay base uri
|
||||
push_relay_uri: String, false, def, "https://push.bitwarden.com".to_string();
|
||||
/// Push relay region |> The data region from https://bitwarden.com/host
|
||||
push_relay_region: String, false, def, "us".to_string();
|
||||
/// Push relay uri
|
||||
push_relay_uri: String, false, auto, |c| {
|
||||
let relay_region = match c.push_relay_region.as_str() {
|
||||
"us" => "com",
|
||||
"eu" => "eu",
|
||||
_ => "com", // Default to US if the region is not recognized
|
||||
};
|
||||
format!("https://push.bitwarden.{}", relay_region)
|
||||
};
|
||||
/// Identity uri
|
||||
identity_uri: String, false, auto, |c| {
|
||||
let relay_region = match c.push_relay_region.as_str() {
|
||||
"us" => "com",
|
||||
"eu" => "eu",
|
||||
_ => "com", // Default to US if the region is not recognized
|
||||
};
|
||||
format!("https://identity.bitwarden.{}", relay_region)
|
||||
};
|
||||
/// Installation id |> The installation id from https://bitwarden.com/host
|
||||
push_installation_id: Pass, false, def, String::new();
|
||||
/// Installation key |> The installation key from https://bitwarden.com/host
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue