Closed davea38 closed 1 year ago
Or another option might be to declare siteUrl as protected and enable me to subClass and override the value in my custom child class?
NB. the use case for this is me centralising my sharepoint host urls via environment vars / configuration files for local dev as we have several sharepoint environments
Hi @davea38,
Maybe this could be helpful https://github.com/koltyakov/node-sp-auth-config#environment-variables if you need binding environment variables?
Generally, you can pass authConfigSettings?: IAuthConfigSettings;
to the constructor options.
Also, if it's the same tenant, proxy can be configured with a root pass.
Thanks for the prompt reply!
I thought about it a bit and actually solved my issue by writing some simple node code that runs prior to the instantiation of the RestProxy class. This checks for the private.json file, then loads it, checks if settings are missing and provides sensible defaults as well as overriding the siteUrl setting from my environment vars.
So now I am controlling my siteUrl centrally and sharing it between sp-rest-proxy, storybook and my react projects via dotenv. Works a treat!
Super! Thanks for sharing the feedback.
Hello!
Is there a mechanism for setting the siteUrl (IProxyContext - which is supplied as part of the configPath settings) programmatically? I've had a look through the types and couldn't see a way to do it?
Could we override siteUrl as part of the settings object that gets passed during the RestProxy constructor maybe?
Many thanks in advance :)