How to use the @cardstack/di.Registry function in @cardstack/di

To help you get started, we’ve selected a few @cardstack/di examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cardstack / cardstack / packages / hub / container-stuff / create-plugin-services.js View on Github external
module.exports = async function createPluginServices() {
  let registry = new Registry();

  registry.register('config:project', {
    path: '/Users/aaron/dev/cardstack/packages/models',
    allowDevDependencies: true
  });

  let container = new Container(registry);

  let loader = container.lookup('hub:plugin-loader');

  let pluginConfigs = loadSeedModels('/Users/aaron/dev/cardstack/packages/models/tests/dummy/cardstack/seeds/development').filter(model => model.type === 'plugin-configs');

  let plugins = await loader.activePlugins(pluginConfigs);

  let services = plugins.listAll('docker-services').map(s => plugins.lookupFeature('docker-services', s));
github cardstack / cardstack / packages / hub / main.js View on Github external
async function wireItUp(projectDir, encryptionKeys, dataSources, opts = {}) {
  let registry = new Registry();
  registry.register('config:project', {
    path: projectDir,
  });
  registry.register('config:environment', { name: opts.environment });
  registry.register('config:data-sources', dataSources);
  registry.register('config:encryption-key', encryptionKeys);
  registry.register('config:public-url', { url: opts.url });
  registry.register('config:ci-session', { id: opts.ciSessionId });
  registry.register(
    'config:pg-boss',
    postgresConfig(
      Object.assign(
        {
          database: process.env.PG_BOSS_DATABASE || `pgboss_${opts.environment}`,
          host: process.env.PG_BOSS_HOST,
          user: process.env.PG_BOSS_USER,

@cardstack/di

dependency injection support for cardstack hub

MIT
Latest version published 1 year ago

Package Health Score

58 / 100
Full package analysis

Similar packages