Skip to content

Commit

Permalink
use genericanem for main service
Browse files Browse the repository at this point in the history
  • Loading branch information
busma13 committed Apr 11, 2024
1 parent bacd4e9 commit e3b648e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
4 changes: 2 additions & 2 deletions packages/terafoundation/src/connectors/s3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ export default {
}
};
},
validate_config(
sysconfig: Terafoundation.SysConfig<any>,
validate_config<S>(
_sysconfig: Terafoundation.SysConfig<S>,
subconfig: S3ClientConfig,
name: string
): void {
Expand Down
9 changes: 5 additions & 4 deletions packages/terafoundation/src/validate-configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,10 @@ export default function validateConfigs<
const listOfValidations: Record<string, Terafoundation.ValidationObj<S>> = {};
const {
schema: sysconfigSchema,
validatorFn: terasliceValidatorFn
validatorFn: mainSvcValidatorFn
} = extractInitializers<S>(config.config_schema, sysconfig);
listOfValidations.teraslice = { validatorFn: terasliceValidatorFn, subconfig: {} };
const mainSvcName = Object.keys(sysconfigSchema)[0];
listOfValidations[mainSvcName] = { validatorFn: mainSvcValidatorFn, subconfig: {} };
const {
schema: foundationSchema,
validatorFn: foundationValidatorFn
Expand Down Expand Up @@ -124,15 +125,15 @@ export default function validateConfigs<
const connectors: Record<string, any> = subConfig.connectors || {};
for (const [connector, connectorConfig] of Object.entries(connectors)) {
const {
schema: connSchema,
schema: connectorSchema,
validatorFn: connValidatorFn
} = getConnectorInitializers<S>(connector);

result[schemaKey].connectors[connector] = {};
for (const [connection, connectionConfig] of Object.entries(connectorConfig)) {
const validatedConnConfig = validateConfig(
cluster,
connSchema,
connectorSchema,
connectionConfig as any
);

Expand Down
20 changes: 10 additions & 10 deletions packages/terafoundation/test/validate-configs-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ describe('Validate Configs', () => {
};
const config = {
config_schema() {
return { schema: {} };
return {};
}
};

Expand All @@ -205,7 +205,7 @@ describe('Validate Configs', () => {
};
const config = {
config_schema() {
return { schema: {} };
return {};
}
};

Expand All @@ -226,7 +226,7 @@ describe('Validate Configs', () => {
};
const config = {
config_schema() {
return { schema: {} };
return {};
}
};

Expand All @@ -247,7 +247,7 @@ describe('Validate Configs', () => {
};
const config = {
config_schema() {
return { schema: {} };
return {};
}
};

Expand Down Expand Up @@ -280,7 +280,7 @@ describe('Validate Configs', () => {
};
const config = {
config_schema() {
return { schema: {} };
return {};
}
};

Expand All @@ -302,7 +302,7 @@ describe('Validate Configs', () => {
};
const config = {
config_schema() {
return { schema: {} };
return {};
}
};

Expand All @@ -328,7 +328,7 @@ describe('Validate Configs', () => {
};
const config = {
config_schema() {
return { schema: {} };
return {};
}
};

Expand Down Expand Up @@ -357,7 +357,7 @@ describe('Validate Configs', () => {
};
const config = {
config_schema() {
return { schema: {} };
return {};
}
};

Expand All @@ -383,7 +383,7 @@ describe('Validate Configs', () => {
};
const config = {
config_schema() {
return { schema: {} };
return {};
}
};

Expand Down Expand Up @@ -443,7 +443,7 @@ describe('Validate Configs', () => {
};
const config = {
config_schema() {
return { schema: {}, validatorFn: testFn };
return { schema: { teraslice: {} }, validatorFn: testFn };
}
};

Expand Down

0 comments on commit e3b648e

Please sign in to comment.