Commit Graph

105 Commits

Author SHA1 Message Date
jannyHou 14eeb4487d update: dependency 2018-07-26 14:16:16 -04:00
Diana Lau d598c3738a chore: update dependencies 2018-07-25 21:59:39 -04:00
Miroslav Bajtoš 473e685a69
Merge pull request #253 from lehni/feature/async-boot-scripts-master
Add support for ES6 style async boot scripts
2017-12-11 10:35:22 +01:00
Zak Barbuto a78a05f9b4 Ignore source maps in boot 2017-09-21 16:35:14 +09:30
Jürg Lehni 6e36f02005 Add support for ES6 style async boot scripts 2017-08-18 12:43:21 +02:00
Raymond Feng 3bb519d5e9 Upgrade deps and fix style issues 2017-05-08 14:48:48 -07:00
Supasate Choochaisri d68ffc6f6f Provide scriptExtensions option 2017-04-01 02:14:47 +07:00
Raymond Feng ac1571ccf1 Refactor for modular and pluggable design
- refactor logic of processing artifacts into their own classes
- introduce Container as the main class for bootstrapping and build a
  registry of handlers during boot to organize them by a hierarchy
  denoted by path
- adopt middleware like registration and invocation
- container.use(path, handler)
- container.run(context, done)
- allow more phases during boot
- boot is now asynchronous
2016-11-22 13:38:28 -05:00
Miroslav Bajtoš 49ed10caaf Normalize line endings to support both LF and CRLF
This should fix build failures on Windows caused by line-ending
mismatch.
2016-09-23 11:16:26 +02:00
Miroslav Bajtoš 748a728a4f Remove "defaultForType" from datasource config
The option "defaultForType" is no longer supported by LoopBack
and causes an unhandled error.
2016-09-23 10:57:53 +02:00
Joshua Estrin Skrzypek 09c3f8365b Replace fs.existsSync calls with fs.statSync 2016-09-05 14:29:51 +02:00
David Cheung dcc575f90b Change test cases port to be dynamic
To avoid port collision when running in Jenkins
2016-08-16 14:37:28 -04:00
Doped Dude 129938bacd Configurable dir for components and middleware
Add two new options `middlewareRootDir` and `componentRootDir`
allowing users to load middleware and/or components from a custom
place
2016-07-27 16:09:46 +02:00
Miroslav Bajtoš eb49c7a386 Merge pull request #195 from strongloop/fix/crypto-warning-in-tests
test: fix security warning
2016-07-19 15:40:06 +02:00
Miroslav Bajtoš 5f5e86e47f test: fix security warning
Add a simple implementation of getRandomValues to the browser context
to get rid of the following warning:

    [SECURITY] node-uuid: crypto not usable, falling back to insecure
    Math.random()
2016-07-01 16:01:58 +02:00
Miroslav Bajtoš 7b226b212e Stop caching config files 2016-07-01 15:38:25 +02:00
Ryan Graham 5eaa909006
update copyright notices and license 2016-05-05 21:52:36 -07:00
juehou d334425ada Add flag var lazyConnect to ds config 2016-05-05 17:33:16 -04:00
Loïc Mahieu 1d2649eee7 parse config: should ignore null values
Fix #182
2016-04-13 11:26:24 +02:00
David Cheung 4a815deb27 Dynamic datasources.json from ENV and config.json
Let environment variables override configuration set by config.json
and/or app.set()

Behavior changes
- datasources.json now support dynamic configuration through
  env-vars and config.json
- component-config.json will first consider env-var
  for resolving dynamic conf, then fallback to config.json
- middleware.json will first consider env-var for resolving
  dynamic conf, then fallback to config.json
- for all the dynamic confg, unresolved conf will return as `undefined`

Example:

Consider the following server/datasources.json
```
{
  "mysql" : {
    "name" : "mysql_db",
    "host" : "${MYSQL_DB_HOST}",
    ...
  }
}
```

Now you can provide the parameter through
an environment variable:

```
$ MYSQL_DB_HOST=127.0.0.1 node .
```

or you can set the value in server/config.json

```
{
  "MYSQL_DB_HOST": "127.0.0.1"
}
```
2016-04-06 10:30:23 -04:00
Miroslav Bajtoš 902005ed8e Use eslint with loopback config
Drop jshint and jscs in favour of eslint.
2016-04-05 15:42:58 +02:00
Miroslav Bajtoš b0e5a0bc63 executor: move "booted" and cb() to the next tick
Fix executor to always emit the "booted" event and call the callback
in the next tick of the event loop, regardless of whether there are any
async boot scripts.

Before this change, adding a listener for "booted" event was cumbersome:

    boot(app);
    if (app.booting)
      app.on('booted', handler);
    else
      handler();

With the fix in place, one can simply write the following:

    boot(app);
    app.on('booted', handler);
2016-02-22 11:01:06 +01:00
Farid Neshat d850560a18 When config is overriden with null don't merge
Fixes #146 and also fixes strongloop/loopback-component-explorer#51
2016-01-08 22:54:17 +08:00
Amir Jafarian 2574c9dbb6 Set app env if it is supplied in options object
Set the app env if it is supplied in options object which solves issue
number 28 under loopback-boot repo
2015-11-30 10:30:09 -05:00
Miroslav Bajtoš 1d27cf0e05 executor: preserve RegExps in middleware paths
Fix interpolateVariables() to skip objects with a non-default
constructor, for example RegExp or Date.
2015-11-04 15:47:55 +01:00
Miroslav Bajtoš c8fdbd5110 Support bluemix env variables for host and port
Detect Bluemix/CouldFoundry environment and automatically apply
VCAP_APP_PORT and VCAP_APP_HOST settings.
2015-10-09 13:21:38 -07:00
yorkie d249b15ce0 add env folder for boot 2015-09-29 12:31:46 +08:00
Ryan Graham a5bc1056aa test: fix strict mode failure
Since the value is undefined at the this point, just remove it so that
linters and strict mode don't cause the entire test suite to abort.
2015-09-08 17:30:30 -07:00
Simon Ho 43042905af Add config variable checks
- Check for config variables defined as functions
- Check for config variables that are undefined
2015-08-31 17:53:27 -07:00
Hage Yaapa 1b491dee85 Resolve ${var} values in component-config.json
App variables can now be specified in component-config.json using
the ${var} format. The value of var is looked up using app.get().

This allows loopback explorer and other loopback components which
require app variables, to be loaded declaratively using
component-config.json.
2015-08-28 11:49:46 +05:30
Hack Sparrow 8b475a97b2 Resolve ${var} values in middleware.json
App variables can now be specified in middleware.json using the ${var}
format. The value of var is looked up using app.get().

This allows loopback.rest and other loopback middleware which require
app variables, to be loaded declaratively using middleware.json.
2015-08-25 18:42:47 +05:30
Raymond Feng b081d828b2 Allow middleware array merge by a key in item objects 2015-08-10 17:17:09 -07:00
Raymond Feng 7362cc489e Enhance middleware config merge 2015-08-07 15:53:28 -07:00
Raymond Feng 450aa6dd21 Merge branch 'master' of github.com:strongloop/loopback-boot into dashby3000-master 2015-07-31 13:45:23 -07:00
Raymond Feng 329fc59113 Fix the build failure 2015-07-31 10:02:16 -07:00
Raymond Feng 02c826337c Fix the model-config/datasource merge 2015-07-31 10:01:53 -07:00
Hage Yaapa 66cc099d1d allow middleware to be optional 2015-06-25 19:32:40 +02:00
Miroslav Bajtoš a63ae8e44b Excl. mod. main path from middleware instructions
When loading middleware configured in "middleware.json", loopback-boot
used to require() the full path to middleware's module main file,
for example "node_modules/strong-express-metrics/index.js".

This is breaking strong-agent probes, as it's difficult to detect
when the intercepted module (e.g. "strong-express-metrics") was loaded.

This commit modifies the compiler to omit the tail (the path to the
module main source file) when requiring middleware.
2015-06-24 17:21:22 +02:00
Jonathan Sheely 44f733f59f Support iisnode using named pipes as PORT value
Port can't be number checked to support iisnode. Using a parseInt()
or number isNumber function won't work if we want to support iisnode
which uses named pipes for ports (ex. \\.\pipe\mypipe)
2015-05-29 10:34:05 +02:00
Miroslav Bajtoš 140180f667 Merge pull request #131 from PradnyaBaviskar/lb-issue-79-mixinsources
support 'mixinsources' option
2015-05-07 16:04:14 +02:00
Pradnya Baviskar 53f51820f5 support 'mixinsources' option
- By default looks for mixinsources in  directory

- Loads only mixins used through models
2015-05-07 14:35:55 +05:30
Miroslav Bajtoš 0563840006 Fix coding style issues, add API docs 2015-05-05 11:28:58 +02:00
Shlomi Assaf b6c60a297d Extend options arg to support custom model definitions
Extend the options argument of boot/compile to allow the developer
to supply custom model definitions (to replace the result of
findModelDefinitions). Together with the existing options.models,
it allows to specify all model-related data and still use the benefits
which loopback-boot provides (most notably loading models in order
defined by inheritance, i.e. base models are loaded before models that
are extending them).
2015-05-05 11:24:02 +02:00
Pradnya Baviskar 9bb988713e add support for mixins
- [mixinDirs]: List of directories to look for files
 containing model mixin definition.
2015-04-24 12:42:56 +05:30
Miroslav Bajtoš e5fd8c7975 executor: fix port lookup
Use the global `isFinite` function to find the first valid port
number. This is the same behaviour as `_.isFinite` in lodash@2.x.

As a result, only values that are a valid number are accepted, e.g.
"0" is accepted but "0xy" is not.
2015-04-23 08:51:24 +02:00
Miroslav Bajtoš acf1868ba4 Support per-application registry of models 2015-04-09 17:56:56 +02:00
Pradnya Baviskar 39d820a657 Use filename as default value for Model name 2015-04-08 14:04:57 +05:30
Pradnya Baviskar 07d276977a Improve the resolution of relative paths
- resolve module relative path for component
 - prioritize coffeescript over json
2015-04-07 13:38:57 +05:30
Miroslav Bajtoš d7c67c803a Merge pull request #113 from PradnyaBaviskar/lb-boot-issue-73-4
Resolve module paths as relative to appRootDir - for middleware
2015-03-20 16:32:24 +01:00
Pradnya Baviskar 3a7b9739d9 Resolve module paths as relative to appRootDir - for middleware 2015-03-20 18:32:45 +05:30