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

Defaults block is not actually the default #34

Open
sirwesley opened this issue Nov 15, 2017 · 2 comments
Open

Defaults block is not actually the default #34

sirwesley opened this issue Nov 15, 2017 · 2 comments

Comments

@sirwesley
Copy link
Contributor

sirwesley commented Nov 15, 2017

According to the documentation, the 'defaults' block is supposed to be the catch-all area, however in testing it appears that 'development' is actually the catch-all section. Recommend fixing the code to make the 'defaults' block the catch-all area if there are no matches, or update the documentation to note that 'development' is the catch-all area if there are no matches.

@sirwesley sirwesley changed the title Defaults block is not actually the defaults Defaults block is not actually the default Nov 15, 2017
@OzzieOrca
Copy link

I believe development is the fallback if no other domains match. defaults will still provide vars not specified in the detected environment.

@OzzieOrca
Copy link

OzzieOrca commented Jun 5, 2020

You can change the fallback environment in the case where no domains match by calling set before check:

// set the domains and variables for each environment
envServiceProvider.config({
  domains: {
    development: ["localhost", "acme.dev.local"],
    production: ["acme.com", "*.acme.com", "acme.dev.prod"],
    test: ["test.acme.com", "acme.dev.test", "acme.*.com"],
    // anotherStage: ['domain1', 'domain2']
  },
  vars: {
    development: {
      apiUrl: "//api.acme.dev.local/v1",
      staticUrl: "//static.acme.dev.local",
      // antoherCustomVar: 'lorem',
      // antoherCustomVar: 'ipsum'
    },
    test: {
      apiUrl: "//api.acme.dev.test/v1",
      staticUrl: "//static.acme.dev.test",
      // antoherCustomVar: 'lorem',
      // antoherCustomVar: 'ipsum'
    },
    production: {
      apiUrl: "//api.acme.com/v1",
      staticUrl: "//static.acme.com",
      // antoherCustomVar: 'lorem',
      // antoherCustomVar: 'ipsum'
    },
    // anotherStage: {
    // 	customVar: 'lorem',
    // 	customVar: 'ipsum'
    // },
    defaults: {
      apiUrl: "//api.default.com/v1",
      staticUrl: "//static.default.com",
    },
  },
});

// default the environment to production
envServiceProvider.set('production')

// run the environment check, so the comprobation is made
// before controllers and services are built
envServiceProvider.check();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants