app-by-profile

1.2.1 • Public • Published

app-by-profile

Allows to get Config and Database for base Maintstar node.js App by profile:

// ex: app - 'permit', profile - default is 'default'
// getByConfig - function which returns database by DBConfig which is taken from Config->Db
getProfileDatabase(app, profile, getByConfig)

// example of getByConfig
var getByConfig = dbCfg => {
  return {
    knex: knex(configDb),
    dao: ...
  }
}
// ex: app - 'permit', profile - default is 'default'
getProfileConfig(app, profile)

typical configuration structure is

/config
  index.js              // base settings
  /profiles
    default.js          // connection to default app, default profile
    deafult_permit.js   // config for permit app db, default profile
    mainCity_permit.js  // config for permit app db, mainCity profile
    ...

Special application profile: It is done to store application specific data, local database, not 3rd party databases.

var cfg = getProfileConfig('app') // will load info from app.js config file

Readme

Keywords

none

Package Sidebar

Install

npm i app-by-profile

Weekly Downloads

1

Version

1.2.1

License

ISC

Last publish

Collaborators

  • vladimirbuskin