refactor(bitwarden): rename server location

This commit is contained in:
Damien Dudognon 2025-03-05 11:15:45 +01:00
parent 51b55a4cd1
commit 61c6ce72c8
No known key found for this signature in database
GPG key ID: 45D954AB469923B0
2 changed files with 6 additions and 6 deletions

View file

@ -52,8 +52,8 @@ export class BitwardenApi implements ICredentialType {
}, },
}, },
{ {
displayName: 'Server Geographies', displayName: 'Region',
name: 'serverLocation', name: 'region',
type: 'options', type: 'options',
default: 'bitwarden.com', default: 'bitwarden.com',
options: [ options: [

View file

@ -13,10 +13,10 @@ import { NodeApiError } from 'n8n-workflow';
* Return the access token URL based on the user's environment. * Return the access token URL based on the user's environment.
*/ */
async function getTokenUrl(this: IExecuteFunctions | ILoadOptionsFunctions) { async function getTokenUrl(this: IExecuteFunctions | ILoadOptionsFunctions) {
const { environment, domain, serverLocation } = await this.getCredentials('bitwardenApi'); const { environment, domain, region } = await this.getCredentials('bitwardenApi');
return environment === 'cloudHosted' return environment === 'cloudHosted'
? `https://identity.${serverLocation}/connect/token` ? `https://identity.${region}/connect/token`
: `${domain}/identity/connect/token`; : `${domain}/identity/connect/token`;
} }
@ -24,9 +24,9 @@ async function getTokenUrl(this: IExecuteFunctions | ILoadOptionsFunctions) {
* Return the base API URL based on the user's environment. * Return the base API URL based on the user's environment.
*/ */
async function getBaseUrl(this: IExecuteFunctions | ILoadOptionsFunctions) { async function getBaseUrl(this: IExecuteFunctions | ILoadOptionsFunctions) {
const { environment, domain, serverLocation } = await this.getCredentials('bitwardenApi'); const { environment, domain, region } = await this.getCredentials('bitwardenApi');
return environment === 'cloudHosted' ? `https://api.${serverLocation}` : `${domain}/api`; return environment === 'cloudHosted' ? `https://api.${region}` : `${domain}/api`;
} }
/** /**