How to use the @fullstack-one/di.Container.set function in @fullstack-one/di

To help you get started, we’ve selected a few @fullstack-one/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 fullstack-build / fullstack-one / packages / db / lib / DbAppClient.ts View on Github external
return row.application_name.replace(this.applicationNamePrefix, "");
      }) as [string];

      // check if number of nodes has changed
      let knownNodeIds: string[] = [];
      try {
        // TODO: Evaluate if its a good idea to push it into container or keep it as a public readonly property of DB
        knownNodeIds = Container.get("knownNodeIds");
      } catch {
        // ignore error
      }

      if (knownNodeIds.length !== nodeIds.length) {
        knownNodeIds = nodeIds;
        // update known IDs in DI
        Container.set("knownNodeIds", knownNodeIds);

        this.logger.debug("Postgres number connected clients changed", knownNodeIds);
        this.eventEmitter.emit("connected.nodes.changed");
      }
    } catch (err) {
      this.logger.warn("updateNodeIdsFromDb", err);
    }
  }
github fullstack-build / fullstack-one / packages / config / lib / index.ts View on Github external
constructor() {
    this.applicationConfig = this.loadApplicationConfig();
    this.registerConfig("Config", `${__dirname}/../config`);

    const namespace = this.config.Config.namespace;
    this.ENVIRONMENT = EnvironmentBuilder.buildEnvironment(this.NODE_ENV, namespace);
    Container.set("ENVIRONMENT", JSON.parse(JSON.stringify(this.ENVIRONMENT)));
  }

@fullstack-one/di

fullstack.one helper package

MIT
Latest version published 3 years ago

Package Health Score

49 / 100
Full package analysis

Similar packages