csharp-ovh icon indicating copy to clipboard operation
csharp-ovh copied to clipboard

How do you change the provider in code without declaring a new client?

Open Snakzi opened this issue 3 years ago • 2 comments

Hello,

is there any option to change the provider inside the code without declaring a new client?

"Client client = new Client("stringprovider")"

works. However, "client.Endpoint = "ovh-eu"" for example does not work?

Best regards

Snakzi avatar Jan 16 '22 14:01 Snakzi

Hi,

Indeed, client.Endpoint is not intended to be modified after instantiation. Since we do not trigger a configuration reload when this value is changed, it will keep its current time offset, secret, application key and so on, so this will not work.

When doing operations on multiple endpoint, I'd create two separate clients and name them EUClient/USClient. Does that create an issue for you?

LukeMarlin avatar Jan 18 '22 10:01 LukeMarlin

Hi,

that would do the trick. Thanks for the heads up!

Snakzi avatar Jan 18 '22 11:01 Snakzi