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

feat(vm): default vm handler #44

Closed
wants to merge 1 commit into from
Closed

Conversation

saitofun
Copy link
Contributor

No description provided.

Comment on lines +45 to +56
var DefaultHandler *Handler

func init() {
var endpoints = make(map[Type]string)
for key, typ := range vmEndpointConfigEnvKeyMap {
if ep := viper.GetString(key); ep != "" {
endpoints[typ] = ep
}
}

DefaultHandler = NewHandler(endpoints)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

why we need it be initialized in init?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried to initialize a default vm handler, if the vm endpoint can be read from env. And then the vm.DefaultHandler will be used to initialize the msg.DefaultHandler.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if some module don't need the default handler, they can create a hander by NewHander

Copy link
Member

Choose a reason for hiding this comment

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

i think default if unnecessary, just NewHandler is more clear

@saitofun saitofun force-pushed the feat/vm/default_handler branch from 19b6fa0 to ddf787d Compare November 15, 2023 08:18
@saitofun saitofun requested a review from CoderZhi November 15, 2023 08:35
@saitofun saitofun force-pushed the feat/vm/default_handler branch from ddf787d to 5d80cd4 Compare November 16, 2023 01:32
@saitofun saitofun closed this Nov 16, 2023
@saitofun saitofun deleted the feat/vm/default_handler branch November 17, 2023 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants