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: check version compatibility with core #236

Closed
wants to merge 6 commits into from
Closed

Conversation

jamil314
Copy link
Collaborator

No description provided.

Comment on lines +536 to +548
const coreVersion = request.headers['x-version']
const countryConfigVersion = process.env.npm_package_version
if (
coreVersion &&
coreVersion !== 'undefined' &&
countryConfigVersion &&
countryConfigVersion !== 'undefined' &&
coreVersion !== countryConfigVersion
) {
const errorMessage = `Version mismatch!! Opencrvs-Core is running on: ${coreVersion}, Opencrvs-Countryconfig is running on: ${countryConfigVersion}`
console.error(errorMessage)
return h.response({ message: errorMessage }).code(426).takeover()
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const coreVersion = request.headers['x-version']
const countryConfigVersion = process.env.npm_package_version
if (
coreVersion &&
coreVersion !== 'undefined' &&
countryConfigVersion &&
countryConfigVersion !== 'undefined' &&
coreVersion !== countryConfigVersion
) {
const errorMessage = `Version mismatch!! Opencrvs-Core is running on: ${coreVersion}, Opencrvs-Countryconfig is running on: ${countryConfigVersion}`
console.error(errorMessage)
return h.response({ message: errorMessage }).code(426).takeover()
}

I'm thinking we could make an assumption here that the client is always up to date as its core's responsibility to verify it. One of our design goals is to hide country config completely behind gateway which would also eliminate this issue

@jamil314
Copy link
Collaborator Author

closing this in favor of previous comment

@jamil314 jamil314 closed this Aug 15, 2024
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.

2 participants