question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Don't hard-code endpoint URL, allow to provide that form web.config

See original GitHub issue

Is there a way to provide endpoint URL from app.config (or other config method) rather than hard-coding the value?

Here is the scenario: I’m developing API and a client for that API. API will be deployed to Azure API Apps, Client will be a WebApp (MVC application). I would like to be able to run both API and a client locally for development phase. Not a problem, I run API locally, point code generator to the local endpoint, get the models created for me - bang! Then I publish API to Azure, I need to update the URL in the generated code on the client. But if I forget to change the endpoint URL on the client, I get into trouble for using http://localhost:5555 when the client app is deployed in Azure. So it would be good if I could specify a way to store the endpoint URL in web.config and on publish stage I could overwrite it for the real endpoint.

I can always change the URL myself and take it from web.config, but it’ll be overwritten on the next code generation…

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
stankovskicommented, Mar 18, 2016

You can pass -useDateTimeOffset flag to AutoRest.exe or even specify it in x-ms-code-generation-setting extension.

0reactions
devignedcommented, Mar 18, 2016

I think DateTimeOffset would be a better choice

Please create an issue and request the enhancement. It sounds like a good idea and one I’d like to get the rest of the team’s feedback on.

I’ll try the extension settings next. It’s actually a lot more fluid to use autorest and set it up as part of the build, than to use the visual studio menu option for generating…

@bradygaster and @mlorbetske, any thoughts on this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Linter rule - no hardcoded environment URL - Microsoft Learn
This rule finds any hard-coded URLs that vary by the cloud environment. Linter rule code. Use the following value in the Bicep configuration...
Read more >
5 ways to set the URLs for an ASP.NET Core app
Using launchSettings.json - Set the URLs using the applicationUrl property. KestrelServerOptions.Listen() - Configure addresses for Kestrel ...
Read more >
How dynamically change API endpoint on Angularjs services ...
So I don't have to hard code api endpoints in my angular app, ... of web.config for transforms and not have to hardcode...
Read more >
Why you should (almost) never use an absolute path to your ...
There are two solutions to fix this small problem: hardcode absolute API URLs on the client and configure CORS headers on the server;...
Read more >
c# - Hardcoding endpoints in library alternative
Then make them configurable, so operations don't have to ask you to change the libraries during your vacation. Maybe a simple configuration ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found