Skip to content

How to substitute values in ocelot.json file using Azure DevOps pipeline? #2010

Answered by tnc1997
saad569 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @saad569, one solution to differing hosts/ports could be to use an ocelot.json configuration file per environment, in a similar way to how the appsettings.json files work.

ocelot.json (default)

  "ReRoutes": [
    {
      "DownstreamPathTemplate": "/downstreampathtemplate",
      "DownstreamScheme": "https",
      "DownstreamHostAndPorts": [
        {
          "Host": "host.azurewebsites.net",
          "Port": 443
        }
      ],
      "UpstreamHttpMethod": [
        "Get"
      ],
      "UpstreamPathTemplate": "/upstreampathtemplate"
    }
  ]

ocelot.Development.json (development)

  "ReRoutes": [
    {
      "DownstreamPathTemplate": "/downstreampathtemplate",
      "DownstreamSc…

Replies: 5 comments 6 replies

Comment options

You must be logged in to vote
2 replies
@raman-m
Comment options

@raman-m
Comment options

Answer selected by raman-m
Comment options

You must be logged in to vote
2 replies
@raman-m
Comment options

@raman-m
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@raman-m
Comment options

Comment options

You must be logged in to vote
1 reply
@raman-m
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Configuration Ocelot feature: Configuration
4 participants
Converted from issue

This discussion was converted from issue #1214 on March 23, 2024 17:25.