set environment don't work

342 views
Skip to first unread message

dinh....@veriksystems.com

unread,
May 26, 2016, 3:14:14 AM5/26/16
to LoopbackJS
Hello,

First, thank a lot for wonderful framework. 

We setup the project with 2 env: development and deployment, following the guide https://docs.strongloop.com/display/public/LB/Environment-specific+configuration

We create setup files for 2 environments under server/

datasources.production.json
component-config.development.json
middleware.development.json
component-config.production.json
middleware.production.json
config.development.json           
model-config.json
config.production.json             
server.js
datasources.development.json

In shell, for instance, set the env: export NODE_ENV=development.

In node shell, we double check with console.log(process.env.NODE_ENV), which print out development.
Until now, I believe that the NODE_ENV is setup right.

But when running node ., we have error.

WARNING: Main config file "config.json" is missing
WARNING: Main config file "datasources.json" is missing
WARNING: Main config file "middleware.json" is missing
WARNING: Main config file "component-config.json" is missing

assert.js:90
  throw new assert.AssertionError({
  ^
AssertionError: User is referencing a dataSource that does not exist: "db"

Well, we believe that the environment setting dont work here, then strongloop continue to look for config.json instead of config.development.json.

We are using strongloop v6.0.1 (node v4.4.4).

Many thanks.

Heath Morrison

unread,
May 26, 2016, 3:23:25 AM5/26/16
to loopb...@googlegroups.com
Hello,

It is unintuitive, but Loopback requires all those files to exist (see the warnings) even if you're also providing environment configs. Even if you're not using them, create the files and stick {} in them.

--
You received this message because you are subscribed to the Google Groups "LoopbackJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to loopbackjs+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/loopbackjs/4693da92-bd6e-467e-8700-a278d9bd3c96%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dinh Nguyen

unread,
May 26, 2016, 4:36:38 AM5/26/16
to loopb...@googlegroups.com
Great thank for quick reply Health,

I see the problem here; though it's strange for me that loopback raise error even when user dont need it.

Best wishes,

You received this message because you are subscribed to a topic in the Google Groups "LoopbackJS" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/loopbackjs/FzHtC7RGkyo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to loopbackjs+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/loopbackjs/CAC%2ByK3es-O9cuRYFAgDXtEg1uFnm2ZESr0%3DxtZhfbBMzmMQWrw%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages