Skip to content

Commit

Permalink
refactor: reuse instance options for all containers (#337)
Browse files Browse the repository at this point in the history
Options should be shared across all containers (they are currently,
if you pass options to addIndexer only resetOnChange will be respected,
other values are used from main options.
  • Loading branch information
Sekhmet authored Feb 3, 2025
1 parent dd7ca59 commit f51dc37
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/checkpoint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default class Checkpoint {
private knex: Knex;
private pgPool?: PgPool;
private checkpointsStore?: CheckpointsStore;
private opts?: CheckpointOptions;

constructor(schema: string, opts?: CheckpointOptions) {
this.schema = extendSchema(schema);
Expand Down Expand Up @@ -56,12 +57,7 @@ export default class Checkpoint {
register.setKnex(this.knex);
}

public addIndexer(
name: string,
config: CheckpointConfig,
indexer: BaseIndexer,
opts?: CheckpointOptions
) {
public addIndexer(name: string, config: CheckpointConfig, indexer: BaseIndexer) {
const validationResult = checkpointConfigSchema.safeParse(config);
if (validationResult.success === false) {
throw new Error(`Checkpoint config is invalid: ${validationResult.error.message}`);
Expand All @@ -76,7 +72,7 @@ export default class Checkpoint {
config,
indexer,
this.schema,
opts
this.opts
);

container.validateConfig();
Expand Down

0 comments on commit f51dc37

Please sign in to comment.