Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implemented externalise config constants pass-down as props pattern #19

Merged
merged 2 commits into from
May 9, 2023

Conversation

victorskl
Copy link
Member

  • Minor refactored and improved arrangement

* Minor refactored and improved arrangement
@victorskl victorskl requested a review from reisingerf May 4, 2023 07:29
@victorskl victorskl self-assigned this May 4, 2023
@victorskl victorskl added this to the Release 0.1.0 milestone May 4, 2023
@victorskl
Copy link
Member Author

Copy link
Member

@reisingerf reisingerf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

description: 'Registry for OrcaBus Events',
},
eventBusProps: {
eventBusName: 'OrcaBusMain',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess that will be used at some point in the stateless config, so probably good to pull out into global const?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. This is already exported as global const i.e. nested/wrapped under orcaBusStatefulConfig object instance.

So. Elsewhere downstream can call like, pseudocode:

new MyConstruct(..., props: cdk.StackProps & OrcaBusStatelessConfig & OrcaBusStatefulConfig) {
  ...
  let busName = props.eventBusProps.eventBusName
}

Or, you mean; do we wish to have a pure global const string for simplicity?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm... good question...
I thought about high level constant, along the same line as
const regName: string = 'OrcaBusSchemaRegistry';

It is true that the value is available from the stateful stack config....
I thought with a separate high level constant the stateless stack could be independent of the stateful stack or its props structure, but the two usually go hand in hand so a bit of dependency is expected/acceptable I guess.
Can always change down the road....

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, like regName var. Right. I know what you mean. Ok, I will update that to realign them.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright. Update with af853c6

},
databaseProps: {
clusterIdentifier: 'orcabus-db',
defaultDatabaseName: 'orcabus',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as for the bus. I suppose the DB name will be needed as well in the stateless stack?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! It might be more like db SM that need externalise.. I will investigate

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will do this with separate PR.

As, there's gonna be a bit involving with how to CDK to spin up Aurora Serverless v2. No L2 construct avail; see thread.

https://umccr.slack.com/archives/C03ABJTSN7J/p1683268082908579

config/constants.ts Outdated Show resolved Hide resolved
lib/workload/orcabus-stateless-stack.ts Show resolved Hide resolved
content: content,
registryName: cProps.registryName,
registryName: props.registryName,
type: 'OpenApi3',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could push this into props as well. Make it optional and default to this value (possible use case for optional config + defaults)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean type: 'OpenApi3'? Sure, happy to update that right away, yes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, since the schema are stateless and defined outside, so this should probably be configurable.
Or would we want to enforce a particular type?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok no prob; I will update it to externalise it as well.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added with af853c6

* Handling var declaration repetition within constants.ts is ok
* Added externalise SchemaType config
@victorskl victorskl requested a review from reisingerf May 8, 2023 08:11
@victorskl
Copy link
Member Author

Merging...

@victorskl victorskl merged commit f7ed31e into refactor-setup May 9, 2023
@victorskl victorskl deleted the implement-externalise-config branch May 9, 2023 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants