Azure / data-api-builder

Data API builder provides modern REST and GraphQL endpoints to your Azure Databases and on-prem stores.
https://aka.ms/dab/docs
MIT License
901 stars 182 forks source link

Config property: Customize hosting port(s) beyond 5000/5001 #1477

Open sajeetharan opened 1 year ago

sajeetharan commented 1 year ago

What happened?

We need to provide CLI or config file option for choosing ports other than 5000 or 5001 for http and https.

For example : While developing locally or host two APIs simultaneously on distinct ports.

Version

0.6.14

What database are you using?

CosmosDB NoSQL

What hosting model are you using?

Local (including CLI)

Which API approach are you accessing DAB through?

GraphQL

Relevant log output

No response

Code of Conduct

Bysza commented 1 year ago

Maybe just use the appsettings file and override the Kestrel or IIS endpoint(s) there? Dab uses aspnet, so if not hardcoded, you can use its config to change ports. Lots of options in the docs: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/endpoints?view=aspnetcore-6.0

seantleonard commented 8 months ago

This needs more discussion to accommodate or exclude swa and hot reload. Kestrel config occurs before any config read/parsing mechanism takes place.

wrutkowski-xebia commented 6 months ago

Some other option to use it, is to run DAB by Docker Container with custom port config.

docker run -it --rm -v "%cd%\swa-db-connections:/App/swa-db-connections" -p 5033:5000 --env DATABASE_CONNECTION_STRING="%DATABASE_CONNECTION_STRING%" mcr.microsoft.com/azure-databases/data-api-builder:0.10.21 --ConfigFileName ./swa-db-connections/staticwebapp.database.config.json

Would be nice to have port configuration in CLI.

seantleonard commented 6 months ago

Maybe just use the appsettings file and override the Kestrel or IIS endpoint(s) there? Dab uses aspnet, so if not hardcoded, you can use its config to change ports. Lots of options in the docs: https://learn.microsoft.com/en-us/aspnet/core/fundamentals/servers/kestrel/endpoints?view=aspnetcore-6.0

Hi @wrutkowski-xebia Until DAB cli offers the ability to update port, please consider using @Bysza's suggestion. The port settings are picked up from appsettings.json