Skip to content

Commit

Permalink
address cr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sundersc committed Apr 9, 2024
1 parent c3e70f2 commit f15aa28
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,22 +198,22 @@ export const schema = configure({
vpcConfig: {
vpcId: \\"abc\\",
securityGroupIds: [
\\"sb0\\",
\\"sb1\\",
\\"sb2\\"
\\"sg0\\",
\\"sg1\\",
\\"sg2\\"
],
subnetAvailabilityZones: [
{
subnetId: \\"sb1\\",
availabilityZone: \\"az1\\"
subnetId: \\"sg0\\",
availabilityZone: \\"az0\\"
},
{
subnetId: \\"sb2\\",
availabilityZone: \\"az2\\"
subnetId: \\"sg1\\",
availabilityZone: \\"az1\\"
},
{
subnetId: \\"sb0\\",
availabilityZone: \\"az3\\"
subnetId: \\"sg2\\",
availabilityZone: \\"az2\\"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ jest.mock('../utils', () => ({
getHostVpc: jest.fn(() => {
return {
vpcId: 'abc',
securityGroupIds: ['sb0', 'sb1', 'sb2'],
securityGroupIds: ['sg0', 'sg1', 'sg2'],
subnetAvailabilityZoneConfig: [
{
subnetId: 'sb1',
availabilityZone: 'az1',
subnetId: 'sg0',
availabilityZone: 'az0',
},
{
subnetId: 'sb2',
availabilityZone: 'az2',
subnetId: 'sg1',
availabilityZone: 'az1',
},
{
subnetId: 'sb0',
availabilityZone: 'az3',
subnetId: 'sg2',
availabilityZone: 'az2',
},
],
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ export class TypescriptDataSchemaGenerator {

private static createIdentifier = (config: TypescriptDataSchemaGeneratorConfig): string => {
const { host, database, engine, port } = config;
// Do not include any secrets such as username or password to compute hash.
// The reason we compute the hash is to generate an unique ID for a SQL datasource that remains the same on subsequent deployments.
// Currently we use engine, host, database and port to generate an unique id.
const identifierString = host.concat(engine, database, port.toString());
const identifierHash = createHash('md5').update(identifierString).digest('base64');
const identifier = `ID${TypescriptDataSchemaGenerator.removeNonAlphaNumericChars(identifierHash)}`;
Expand Down

0 comments on commit f15aa28

Please sign in to comment.