Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibility to set base url for api calls #34

Closed
sesigl opened this issue Nov 23, 2017 · 8 comments
Closed

Possibility to set base url for api calls #34

sesigl opened this issue Nov 23, 2017 · 8 comments
Assignees

Comments

@sesigl
Copy link

sesigl commented Nov 23, 2017

Hi,

is there a way to set the base url for accessing kentico cloud? I would like to proxy all calls to protect sensitive data. Is there are global config parameter available?

If not can you please add a configuration?

Instead of calling:
https://preview-deliver.kenticocloud.com/{key}/items?system.type=article

it should call:
https://{custom url}/items?system.type=article

when set.

@edouardr
Copy link
Contributor

The urls for delivery and preview API are set in the QueryService class as private readonly attributs.

What about exposing them in the DeliveryClientConfig class? QueryService is already instantiated with the config object.

@sesigl
Copy link
Author

sesigl commented Nov 24, 2017

Sounds Good for me. Looking forward to an implementation and documentation ;).

@petrsvihlik
Copy link
Contributor

See how it's implemented in the .net sdk for reference.

@Enngage Enngage self-assigned this Nov 24, 2017
@sesigl
Copy link
Author

sesigl commented Nov 24, 2017

alright, so what do you mean by that? Do you ask me to contribute ? Or will you do/delegate it?

I'm open minded in this case :).

@petrsvihlik
Copy link
Contributor

@Journerist sorry for confusion, it was rather a generic remark, not addressed to anyone in particular :)

It would be great if you could take care of it.

So what we did in the .NET SDK is that we introduced a DeliveryOptions object, adjusted DeliveryClient's constructors. And here's an example of how it can be used: https://github.com/Kentico/delivery-sdk-net/wiki/Using-the-ASP.NET-Core-Configuration-API-and-DI-to-Instantiate-the-DeliveryClient.

I'm not saying we should do it the exactly same thing but the general look&feel should be somewhat similar :)

Please let us know if you're willing to contribute so that we can assign the issue to you.

@Enngage
Copy link
Member

Enngage commented Nov 24, 2017

Hey guys,

This is a good idea. I implemented it so that you can specify base urls when instantiating DeliveryClientConfig. I published it in 2.1.2 release:

new DeliveryClientConfig('projectId', [], {
      baseUrl: 'http://customurl.com',
      basePreviewUrl: 'http://custompreview.com'
    });

Let me know how that works and if you have any further suggestions.

@sesigl
Copy link
Author

sesigl commented Nov 24, 2017

@Enngage thank you, this is awesome. I'll try it this evening and give you feedback if this works for me.

@sesigl
Copy link
Author

sesigl commented Nov 24, 2017

I already love it, works amazingly. Finally I can get rid of my ugly hack :P. Thanks a lot ! <3

@sesigl sesigl closed this as completed Nov 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants