Giter Club home page Giter Club logo

rejoice's People

Contributors

arb avatar bryant1410 avatar cilindrox avatar cjihrig avatar geek avatar kevinji avatar kevinmstephens avatar lloydbenson avatar marsup avatar maxbeatty avatar mikefrey avatar nargonath avatar simondegraeve avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rejoice's Issues

Question - hidden feature rejoice supports env variable replacement?

So I was looking through the source trying to trace down how to setup our modules to work both in development and in production where the paths for plugins can be drastically different. Ideally using the -p option should take care of this.

However while I was looking I found this segment of code

internals.parseEnv = function (manifest) {

    if (!manifest ||
        typeof manifest !== 'object') {

        return;
    }

    Object.keys(manifest).forEach(function (key) {

        var value = manifest[key];
        if (typeof value === 'string' &&
            value.indexOf('$env.') === 0) {

            manifest[key] = process.env[value.slice(5)];
        }
        else {
            internals.parseEnv(value);
        }
    });
};

This appears to search for keys in the manifest file that start with $env. and does substitution on a key with a value specified in the process environment. Is this documented somewhere or did I miss it?

Can't find module rejoice

I'm trying to implement rejoice but I'm having a problem.

I got a manifest file called ./config.json.

I'm calling node rejoice -c config.json and getting

Error: Cannot find module 'D:\Projects\metaphor\rejoice'

I thought maybe it couldn't find node_modules so I tried

node rejoice -c config.json -p /node_modules but that didn't work either.

So what am I doing wrong? :)

Question: rejoice -r and newrelic.js

I'm not sure if you're familiar with newrelic.js for Hapi or how it's implemented. However in the simpliest of implementations it only requires the inclusion of require('newrelic'); in you hapi server.

I've tried something similar to the following:

rejoice -c manifest.json -r 'path/to/newrelic'

Unfortunately I received the following response from the newrelic agent log.

{"v":0,"level":40,"name":"newrelic","hostname":"hostname","pid":1549,"time":"2015-09-18T21:52:24.200Z","msg":"The newrelic module must be the first module required.\nThe following modules were required before newrelic and are not being instrumented:\n\thapi"}

Seems like it's not possible and that my only option is to include there require('newrelic') either in a new hapi plugin definition, use a start.js script, or include the require('newrelic') in an existing plugin.

Thoughts?

Question: Typical Use Case

I'm in the process of a PR to separate the behavior of -p and -p + -r into another command-line option.

I'm seeking guidance on the typical use case:

  1. rejoice -c config.json -p ./lib
    For the purpose of specifying the location of hapi plugins in the manifest
  2. rejoice -c config.json -r module -r module
    No need for -p and use ./node_modules as the location for -r
  3. rejoice -c config.json -r module -p path_to_base_dir_node_modules_used_by_dash_r
    Coupling -r and -p together.

Example of JS code in addition to JSON configuration?

Hi!

I'm sure I'm missing something obvious, but it isn't clear to me how the JSON configuration file listed in the README hooks up with the JavaScript file I assume must exist somewhere defining routes, etc. Would it be possible to have a 'full-stack' example? Or am I entirely misunderstanding how rejoice is to be used?

Dealing with node and local modules and the -p flag

I am new to the hapi universe and giving rejoice a try, I encountered this error:

module.js:327
    throw err;
    ^
Error: Cannot find module 'vision'
[...]

when trying to launch it with

rejoice -c manifest.json

and a few variations with -p [DIRECTORY], always getting the same error.

I already had a manifest.json file, which I've attached. I'm also attaching the simple glue script I am using (before turning to rejoice) which works as expected.

vision and other required npm modules are all referenced in package.json and installed.

Oh well, attaching files isn't working for me now, so here we go:

manifest.json:

{
  "connections": [ { "port": 8800 } ],
  "registrations": [
    { "plugin": "vision" },
    {
      "plugin": {
        "register": "visionary",
        "options": {
          "engines": { "pug": "pug" },
          "path": "tpls"
        }
      }
    },
    {
      "plugin": { "register": "./routes/bap" },
      "options": { "routes": { "prefix": "/woot" } }
    },
    { "plugin": "./routes/home" },
    {
      "plugin": {
        "register": "good",
        "options": {
          "reporters": {
            "console": [
              {
                "module": "good-squeeze",
                "name": "Squeeze",
                "args": [{
                  "response": "*",
                  "log": "*"
                }]
              },
              { "module": "good-console" },
              "stdout"
            ]
          }
        }
      }
    }
  ]
}

server.js: (my current alternative to rejoice)

'use strict'

const Glue = require('glue')

Glue.compose(require('./manifest.json'), { relativeTo: __dirname })
  .then((server) => {
    server.start()
    return server
  })
  .then((server) => {
    console.log('hapi days!', server.info.uri)
  })
  .catch((err) => {
    console.error('ERROR:', err)
  })

Referencing functions in plugin config

Sometimes it's impossible to define all plugins via glue's manifest,
(i.e when a method should be referenced by the plugin options)

It could be nice if rejoice could support hooks where plugins can be registered programmatically, maybe by leveraging glue's preConnections / prePlugins hooks.

Thanks.

Support for Confidence (configuration document format)?

It would be nice to support Confidence format for the manifest, using JSON is too limited.

Example:

If I use the good plugin with a custom reporter, the path to load the reporter is relative to the rejoice directory, not to the manifest file directory, so that's confusing. With Confidence I could use absolute path with __dirname in the manifest file.

JSON Environment Variables

I would like my configuration file to reference JSON environment variables. I don’t believe Rejoice can handle this:

"plugins": { "dbModule": "$env.jsonEnvVariable" }

where jsonEnvVariable is a list of db connection details as such:

[{"options":{"name":"db1", ... }}
,{"options":{"name":"db2", ...}}]

Rejoice passes this environment variable one time into the dbModule register function as a string (as expected). I would like it to call the dbModule register function twice, once for each option object (how it behaves if the JSON is hardcoded). This would allow me to continue leveraging the simplicity of Rejoice for configuration setup rather than handling this in the dbModule.

My suggestion for a fix:

Rejoice's parseEnv function (line 110) could check if

process.env[value.slice(5)]

returns valid JSON, and if so,

JSON.parse the key value rather than keep it a string.

Something like this:

try{
        manifest[key] = JSON.parse(process.env[value.slice(5)]);
    }

catch(e){
                manifest[key] = process.env[value.slice(5)];
            }

Deprecate?

Anyone using this module? Time to deprecate?

If not, please open a hapi v17 issue to migrate.

3.3.0 Fails to install

The latest version, 3.3.0, fails on install, at least on linux based systems. I am seeing the following output on npm install both on my local development environment (ubuntu trusty64 build) and in our travis environment. Version 3.2.0, which was the most recent version until earlier this morning, still installs just fine.

npm install [email protected]
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]
npm WARN [email protected] No repository field.
npm ERR! Linux 3.13.0-87-generic
npm ERR! argv "/home/vagrant/.nvm/versions/node/v5.11.1/bin/node" "/home/vagrant/.nvm/versions/node/v5.11.1/bin/npm" "install" "[email protected]"
npm ERR! node v5.11.1
npm ERR! npm  v3.8.6
npm ERR! path /vagrant/node_modules/rejoice/bin/rejoice
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod

npm ERR! enoent ENOENT: no such file or directory, chmod '/vagrant/node_modules/rejoice/bin/rejoice'
npm ERR! enoent ENOENT: no such file or directory, chmod '/vagrant/node_modules/rejoice/bin/rejoice'

yaml support

would you accept a PR for supporting a manifest file in YAML format?

docs are not very rich...

I'm not seeing a whole lot on how to configure the rejoice server, In addition, I want to add more data to the config, but when I try to place my data key somewhere I keep getting things like:

 Error: Invalid server options {
  "load": {
    "sampleInterval": 1000
  },
  "remoteAPI" [1]: "https://xxxsss.api.xxxsss.com/v1/xxxxxsss"
}

or Invalid manifest

Passing arbitrary flags through to Node

Is there/can there be a way to pass arguments on to Node (for instance to set Node's debug port). For instance if I had rejoice -c manifest.js -p . -- --debug-brk=5959 as the target of a run script, everything after -- would be passed directly to Node.

I posted a work-around on StackOverflow, but having a cleaner syntax[1] would be nicer.

[1] Reaching into node_modules/.bin feels wrong and possibly brittle, and it side-steps one of the major benefits to using run scripts in the first place.

Javascript File

Would you accept a PR for loading .js file ?

Why?

I would like to use some values based on environments, for example i want to run on the port 1337 if is local and 80 if production, this just an example but give you an idea why i would like to have that feature.

Thanks.

upgrade rejoice dependencies

Looks like there is a new glue and other updates to dependencies. This is always a breaking change as with glue, you don't need to include which hapi version you are using.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.