mirror of
https://github.com/Mastermindzh/react-starter-kit.git
synced 2025-08-23 17:44:52 +02:00
Moved config to infrastructure :)
This commit is contained in:
4
src/infrastructure/config/RunTimeConfig.ts
Normal file
4
src/infrastructure/config/RunTimeConfig.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export interface RunTimeConfig {
|
||||
version: number;
|
||||
name: string;
|
||||
}
|
15
src/infrastructure/config/config.ts
Normal file
15
src/infrastructure/config/config.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import deepmerge from "deepmerge";
|
||||
|
||||
/**
|
||||
* gets and merges both the regular config and the override config from the window
|
||||
* into window.mergedConfig
|
||||
*/
|
||||
export const mergeConfigs = () => {
|
||||
if (!window.mergedConfig) {
|
||||
window.mergedConfig = deepmerge(window.defaultConfig, window.configOverride ?? {});
|
||||
}
|
||||
};
|
||||
|
||||
mergeConfigs();
|
||||
|
||||
export const Config = window.mergedConfig;
|
1
src/infrastructure/config/index.ts
Normal file
1
src/infrastructure/config/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./config";
|
@@ -2,7 +2,7 @@ import { DateTime } from "luxon";
|
||||
import { FunctionComponent } from "react";
|
||||
import { Trans, useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router-dom";
|
||||
import { Config } from "../../config";
|
||||
import { Config } from "../config";
|
||||
import "./Navbar.css";
|
||||
type Props = {};
|
||||
|
||||
|
Reference in New Issue
Block a user