0.1.0 • Published 7 years ago

shaara-core v0.1.0

Weekly downloads
6
License
ISC
Repository
-
Last release
7 years ago

shaara-core

Provide the Kernel of Shaara.

Kernel

The job of the Kernel is to orchestrate the application and it's various components. The base of it is to handle services.

Basic Example :

import Shaara from "shaara-core";

const kernel = await Shaara.Kernel.create({
  getEnvironment: () => {
    return "test";
  },
  getParameters: () => {
    return {
      databaseUsername: "foo",
      databasePassword: "bar",
    }
  },
  getServices: (services, parameters, env) => {
    // parameters contains the parameters given in getParameters
    // env contains the current environment.

    return {
      "random.service": randomService
    }
  }
});

Services

A service is a simple object that do whatever you want. It's completely user defined. It must be registered using the getServices function.

Kernel.create configuration

̀getEnvironment()`

Return the current environment. If not specified, reads process.env.NODE_ENV.

̀getParameters(env : string)`

Return a list of parameters.

getServices(services : {[key: string]: Object}, parameters : Object, env : string)

Return a list of service.

  • services : the kernel may have already defined services (see tasks & presets). In this case you can use some of them in this function to initialize your own services. Note that if you return a service with an already-used name, you will override it.
  • parameters : previously defined parameters
  • env : the current environment
0.1.0

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago