How to use the @loopback/context.config function in @loopback/context

To help you get started, we’ve selected a few @loopback/context 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 strongloop / loopback-next / packages / boot / src / booters / interceptor.booter.ts View on Github external
constructor(
    @inject(CoreBindings.APPLICATION_INSTANCE)
    public app: Application,
    @inject(BootBindings.PROJECT_ROOT) projectRoot: string,
    @config()
    public interceptorConfig: ArtifactOptions = {},
  ) {
    super(
      projectRoot,
      // Set InterceptorProvider Booter Options if passed in via bootConfig
      Object.assign({}, InterceptorProviderDefaults, interceptorConfig),
    );
  }
github strongloop / loopback-next / packages / boot / src / booters / lifecyle-observer.booter.ts View on Github external
constructor(
    @inject(CoreBindings.APPLICATION_INSTANCE)
    public app: Application,
    @inject(BootBindings.PROJECT_ROOT) projectRoot: string,
    @config()
    public observerConfig: ArtifactOptions = {},
  ) {
    super(
      projectRoot,
      // Set LifeCycleObserver Booter Options if passed in via bootConfig
      Object.assign({}, LifeCycleObserverDefaults, observerConfig),
    );
  }
github strongloop / loopback-next / packages / boot / src / booters / service.booter.ts View on Github external
constructor(
    @inject(CoreBindings.APPLICATION_INSTANCE)
    public app: ApplicationWithServices,
    @inject(BootBindings.PROJECT_ROOT) projectRoot: string,
    @config()
    public serviceConfig: ArtifactOptions = {},
  ) {
    super(
      projectRoot,
      // Set Service Booter Options if passed in via bootConfig
      Object.assign({}, ServiceDefaults, serviceConfig),
    );
  }
github strongloop / loopback-next / packages / boot / src / booters / controller.booter.ts View on Github external
constructor(
    @inject(CoreBindings.APPLICATION_INSTANCE) public app: Application,
    @inject(BootBindings.PROJECT_ROOT) projectRoot: string,
    @config()
    public controllerConfig: ArtifactOptions = {},
  ) {
    super(
      projectRoot,
      // Set Controller Booter Options if passed in via bootConfig
      Object.assign({}, ControllerDefaults, controllerConfig),
    );
  }
github strongloop / loopback-next / examples / greeter-extension / src / greeting-service.ts View on Github external
constructor(
    /**
     * Inject a getter function to fetch greeters (bindings tagged with
     * `{[CoreTags.EXTENSION_POINT]: GREETER_EXTENSION_POINT_NAME}`)
     */
    @extensions()
    private getGreeters: Getter,
    /**
     * An extension point should be able to receive its options via dependency
     * injection.
     */
    @config() // Sugar for @inject('services.GreetingService.options', {optional: true})
    public readonly options?: GreetingServiceOptions,
  ) {}
github strongloop / loopback-next / packages / boot / src / booters / datasource.booter.ts View on Github external
constructor(
    @inject(CoreBindings.APPLICATION_INSTANCE)
    public app: ApplicationWithRepositories,
    @inject(BootBindings.PROJECT_ROOT) projectRoot: string,
    @config()
    public datasourceConfig: ArtifactOptions = {},
  ) {
    super(
      projectRoot,
      // Set DataSource Booter Options if passed in via bootConfig
      Object.assign({}, DataSourceDefaults, datasourceConfig),
    );
  }
github strongloop / loopback-next / packages / boot / src / booters / repository.booter.ts View on Github external
constructor(
    @inject(CoreBindings.APPLICATION_INSTANCE)
    public app: ApplicationWithRepositories,
    @inject(BootBindings.PROJECT_ROOT) projectRoot: string,
    @config()
    public repositoryOptions: ArtifactOptions = {},
  ) {
    super(
      projectRoot,
      // Set Repository Booter Options if passed in via bootConfig
      Object.assign({}, RepositoryDefaults, repositoryOptions),
    );
  }
github strongloop / loopback-next / packages / authentication / src / providers / auth-metadata.provider.ts View on Github external
constructor(
    @inject(CoreBindings.CONTROLLER_CLASS, {optional: true})
    private readonly controllerClass: Constructor<{}>,
    @inject(CoreBindings.CONTROLLER_METHOD_NAME, {optional: true})
    private readonly methodName: string,
    @config({fromBinding: AuthenticationBindings.COMPONENT})
    private readonly options: AuthenticationOptions = {},
  ) {}
github strongloop / loopback-next / examples / greeter-extension / src / greeters / greeter-cn.ts View on Github external
constructor(
    /**
     * Inject the configuration for ChineseGreeter
     */
    @config()
    private options: ChineseGreeterOptions = {nameFirst: true},
  ) {}
github strongloop / loopback-next / examples / context / src / configuration-injection.ts View on Github external
constructor(
    /**
     * Inject configuration for this bound instance
     */
    @config() private settings: GreeterConfig = {},
  ) {}