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.

How should basePaths for multiple environments be specified?

See original GitHub issue

For instance, development vs test vs staging vs production?

We’ve been putting them in a parallel basePaths like:

{
  basePath: 'http://api.example.com'
  basePaths: {
    development: 'http://api.dev-example.com',
    test: 'http://api.test-example.com',
    stage: 'http://api.stage-example.com',
    production: 'http://api.example.com'
  }
}

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:4
  • Comments:17 (8 by maintainers)

github_iconTop GitHub Comments

7reactions
webroncommented, Sep 19, 2014

In Swagger 2.0 the definition of basePath has changed. It has been split to 3 properties - scheme, host and basePath. The basePath now becomes the actual base path which is relative to the host. If the host is not specified, the basePath is taken against the host that’s serving the specification. Does this answer your need?

1reaction
webroncommented, Sep 20, 2014

@shelbys - it does not directly cover it. I’m just saying that if you don’t include them, and host your swagger.json on each of those environment separately, you wouldn’t need to change the basePath each time for the relevant environment.

We’re working on a way to document several micro-services, but even there you’d need to duplicate your swagger.json with a different basePath. You’d have a centralized description though of the different environments.

Read more comments on GitHub >

github_iconTop Results From Across the Web

API Server and Base Path - Swagger
In OpenAPI 3.0, you use the servers array to specify one or more base URLs for your API. servers replaces the host ,...
Read more >
Different base paths depending on Development/Production ...
First I changed the base url so that only when the Development environment variable is found, the base url /UserManagement will be used:...
Read more >
Multiple revisions deployed in an environment
This is more of a conceptual question. I can deploy multiple revisions of the same API to the same environment through the deployment...
Read more >
How to Model Your Gitops Environments - Codefresh
These settings belong to the set of configuration that we don't expect to promote between environments, but we assume that they will be...
Read more >
API from multiple hosts/base paths - Spec - RAML Forum
One of the related use case I find is to host in multiple environments (e.g. dev, test, staging, prod) and able to specify...
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