Skip to content

lb4 repository tool error if datasource is using injection #8015

Open
@clewisln

Description

@clewisln

I have a simple data source, whos config is loaded via injection:

export class MainDataSource extends juggler.DataSource
  implements LifeCycleObserver {
  static dataSourceName = 'Main';

  constructor(
    @config()
    dsConfig: object,
  ) {
    super(dsConfig);
  }
}

Application.ts:
this.configure('datasources.Main').to(options.datasources?.Main || {});

When running the repository scaffolding tool the following error occurs:
(node:24064) UnhandledPromiseRejectionWarning: Error: Cannot load C:\lb4\src\datasources\main.datasource.config.json: ENOENT: no such file or directory, open 'C:\lb4\src\datasources\main.datasource.config.json'

I am temporarily suppressing the error by adding a main.datasource.config.json file in the source directory.

However, this scaffolding tool should not require a fully configured data source to generate simple repositories. If the configuration cannot be found, it should just emit a warning, but still allow the tool to run and generate a non-customized class using the basic boilerplate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions