-
Notifications
You must be signed in to change notification settings - Fork 486
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
Refactor care config to use camelCase variables and remove useConfig
hook
#8450
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d31a6a6
Remove fireRequestV2 (#8446)
sainak 533578a
Merge branch 'develop' into rithviknishad/fix/camelCase-config
rithviknishad 6f07fc9
Refactor care config to use camel case and remove `useConfig` hook
rithviknishad d901438
fix storybook vite config
rithviknishad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,10 @@ | ||
import path from "node:path"; | ||
|
||
/** @type {import('vite').UserConfig} */ | ||
export default {}; | ||
export default { | ||
resolve: { | ||
alias: { | ||
"@careConfig": path.resolve(__dirname, "../care.config.ts"), | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,103 +1,95 @@ | ||
export interface Logo { | ||
const env = import.meta.env; | ||
|
||
interface ILogo { | ||
light: string; | ||
dark: string; | ||
} | ||
|
||
export interface CareConfig { | ||
dashboard_url?: string; | ||
github_url: string; | ||
ohcn_url: string; | ||
site_url: string; | ||
analytics_server_url: string; | ||
main_logo: Logo; | ||
state_logo?: Logo; | ||
custom_logo?: Logo; | ||
custom_logo_alt?: Logo; | ||
custom_description?: string; | ||
gmaps_api_key: string; | ||
gov_data_api_key: string; | ||
recaptcha_site_key: string; | ||
sentry_dsn: string; | ||
sentry_environment: string; | ||
header_logo: Logo; | ||
kasp_enabled: boolean; | ||
kasp_string: string; | ||
kasp_full_string: string; | ||
sample_format_asset_import: string; | ||
sample_format_external_result_import: string; | ||
enable_hcx: boolean; | ||
enable_abdm: boolean; | ||
enable_scribe: boolean; | ||
wartime_shifting: boolean; | ||
jwt_token_refresh_interval?: number; | ||
min_encounter_date: string; | ||
} | ||
const logo = (value?: string, fallback?: ILogo) => { | ||
return value ? (JSON.parse(value) as ILogo) : fallback; | ||
}; | ||
|
||
export const careConfig: CareConfig = { | ||
dashboard_url: import.meta.env.REACT_DASHBOARD_URL, | ||
github_url: | ||
import.meta.env.REACT_GITHUB_URL || "https://github.com/ohcnetwork", | ||
ohcn_url: import.meta.env.REACT_OHCN_URL || "https://ohc.network?ref=care", | ||
site_url: import.meta.env.REACT_SITE_URL || "care.ohc.network", | ||
analytics_server_url: | ||
import.meta.env.REACT_ANALYTICS_SERVER_URL || | ||
"https://plausible.10bedicu.in", | ||
header_logo: { | ||
light: | ||
import.meta.env.REACT_HEADER_LOGO_LIGHT || | ||
"https://cdn.ohc.network/header_logo.png", | ||
dark: | ||
import.meta.env.REACT_HEADER_LOGO_DARK || | ||
"https://cdn.ohc.network/header_logo.png", | ||
}, | ||
main_logo: { | ||
light: | ||
import.meta.env.REACT_MAIN_LOGO_LIGHT || | ||
"https://cdn.ohc.network/light-logo.svg", | ||
dark: | ||
import.meta.env.REACT_MAIN_LOGO_DARK || | ||
"https://cdn.ohc.network/black-logo.svg", | ||
const careConfig = { | ||
apiUrl: env.REACT_CARE_API_URL, | ||
|
||
urls: { | ||
dashboard: env.REACT_DASHBOARD_URL, | ||
github: env.REACT_GITHUB_URL || "https://github.com/ohcnetwork", | ||
ohcn: env.REACT_OHCN_URL || "https://ohc.network?ref=care", | ||
}, | ||
state_logo: import.meta.env.REACT_STATE_LOGO | ||
? JSON.parse(import.meta.env.REACT_STATE_LOGO) | ||
: undefined, | ||
custom_logo: import.meta.env.REACT_CUSTOM_LOGO | ||
? JSON.parse(import.meta.env.REACT_CUSTOM_LOGO) | ||
: undefined, | ||
custom_logo_alt: import.meta.env.REACT_CUSTOM_LOGO_ALT | ||
? JSON.parse(import.meta.env.REACT_CUSTOM_LOGO_ALT) | ||
: undefined, | ||
custom_description: import.meta.env.REACT_CUSTOM_DESCRIPTION, | ||
gmaps_api_key: | ||
import.meta.env.REACT_GMAPS_API_KEY || | ||
"AIzaSyDsBAc3y7deI5ZO3NtK5GuzKwtUzQNJNUk", | ||
gov_data_api_key: | ||
import.meta.env.REACT_GOV_DATA_API_KEY || | ||
|
||
headerLogo: logo(env.REACT_HEADER_LOGO, { | ||
light: "https://cdn.ohc.network/header_logo.png", | ||
dark: "https://cdn.ohc.network/header_logo.png", | ||
}), | ||
mainLogo: logo(env.REACT_MAIN_LOGO, { | ||
light: "https://cdn.ohc.network/light-logo.svg", | ||
dark: "https://cdn.ohc.network/black-logo.svg", | ||
}), | ||
stateLogo: logo(env.REACT_STATE_LOGO), | ||
customLogo: logo(env.REACT_CUSTOM_LOGO), | ||
customLogoAlt: logo(env.REACT_CUSTOM_LOGO_ALT), | ||
customDescription: env.REACT_CUSTOM_DESCRIPTION, | ||
|
||
gmapsApiKey: | ||
env.REACT_GMAPS_API_KEY || "AIzaSyDsBAc3y7deI5ZO3NtK5GuzKwtUzQNJNUk", | ||
|
||
govDataApiKey: | ||
env.REACT_GOV_DATA_API_KEY || | ||
"579b464db66ec23bdd000001cdd3946e44ce4aad7209ff7b23ac571b", | ||
recaptcha_site_key: | ||
import.meta.env.REACT_RECAPTCHA_SITE_KEY || | ||
"6LdvxuQUAAAAADDWVflgBqyHGfq-xmvNJaToM0pN", | ||
sentry_dsn: | ||
import.meta.env.REACT_SENTRY_DSN || | ||
"https://[email protected]/5183632", | ||
sentry_environment: import.meta.env.REACT_SENTRY_ENVIRONMENT || "staging", | ||
kasp_enabled: import.meta.env.REACT_KASP_ENABLED === "true", | ||
kasp_string: import.meta.env.REACT_KASP_STRING || "KASP", | ||
kasp_full_string: | ||
import.meta.env.REACT_KASP_FULL_STRING || | ||
"Karunya Arogya Suraksha Padhathi", | ||
sample_format_asset_import: | ||
import.meta.env.REACT_SAMPLE_FORMAT_ASSET_IMPORT || | ||
"/asset-import-template.xlsx", | ||
sample_format_external_result_import: | ||
import.meta.env.REACT_SAMPLE_FORMAT_EXTERNAL_RESULT_IMPORT || | ||
"/External-Results-Template.csv", | ||
enable_hcx: import.meta.env.REACT_ENABLE_HCX === "true", | ||
enable_abdm: import.meta.env.REACT_ENABLE_ABDM === "true" || true, | ||
enable_scribe: import.meta.env.REACT_ENABLE_SCRIBE === "true", | ||
wartime_shifting: import.meta.env.REACT_WARTIME_SHIFTING === "true", | ||
jwt_token_refresh_interval: import.meta.env.REACT_JWT_TOKEN_REFRESH_INTERVAL | ||
? parseInt(import.meta.env.REACT_JWT_TOKEN_REFRESH_INTERVAL) | ||
: undefined, | ||
min_encounter_date: import.meta.env.REACT_MIN_ENCOUNTER_DATE || "2020-01-01", | ||
}; | ||
reCaptchaSiteKey: | ||
env.REACT_RECAPTCHA_SITE_KEY || "6LdvxuQUAAAAADDWVflgBqyHGfq-xmvNJaToM0pN", | ||
|
||
kasp: { | ||
enabled: env.REACT_KASP_ENABLED === "true", | ||
string: env.REACT_KASP_STRING || "KASP", | ||
fullString: | ||
env.REACT_KASP_FULL_STRING || "Karunya Arogya Suraksha Padhathi", | ||
}, | ||
|
||
sampleFormats: { | ||
assetImport: | ||
env.REACT_SAMPLE_FORMAT_ASSET_IMPORT || "/asset-import-template.xlsx", | ||
externalResultImport: | ||
env.REACT_SAMPLE_FORMAT_EXTERNAL_RESULT_IMPORT || | ||
"/External-Results-Template.csv", | ||
}, | ||
|
||
wartimeShifting: env.REACT_WARTIME_SHIFTING === "true", | ||
|
||
auth: { | ||
tokenRefreshInterval: env.REACT_JWT_TOKEN_REFRESH_INTERVAL | ||
? parseInt(env.REACT_JWT_TOKEN_REFRESH_INTERVAL) | ||
: 5 * 60e3, | ||
}, | ||
|
||
minEncounterDate: new Date(env.REACT_MIN_ENCOUNTER_DATE || "2020-01-01"), | ||
|
||
// Plugins related configs... | ||
|
||
plausible: { | ||
server: env.REACT_PLAUSIBLE_SERVER_URL || "https://plausible.10bedicu.in", | ||
domain: env.REACT_PLAUSIBLE_SITE_DOMAIN || "care.ohc.network", | ||
}, | ||
|
||
sentry: { | ||
dsn: | ||
env.REACT_SENTRY_DSN || | ||
"https://[email protected]/5183632", | ||
environment: env.REACT_SENTRY_ENVIRONMENT || "staging", | ||
}, | ||
|
||
hcx: { | ||
enabled: env.REACT_ENABLE_HCX === "true", | ||
}, | ||
|
||
abdm: { | ||
enabled: (env.REACT_ENABLE_ABDM ?? "true") === "true", | ||
}, | ||
|
||
scribe: { | ||
enabled: env.REACT_ENABLE_SCRIBE === "true", | ||
}, | ||
} as const; | ||
|
||
export default careConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets add examples when the we are expecting structures.