aboutsummaryrefslogtreecommitdiff
path: root/src/config.ts
diff options
context:
space:
mode:
authorGravatar Corentin Thomasset <corentin.thomasset74@gmail.com> 2022-05-24 00:07:54 +0200
committerGravatar Corentin Thomasset <corentin.thomasset74@gmail.com> 2022-05-24 00:07:54 +0200
commit6becdbb42329e1bdecf158707e37ba9f13ba1d2c (patch)
treed295e11b473d72685016ee9659604538da601db0 /src/config.ts
parent5ce1262fb44864b829dac09d5c0b9b68d522ceb7 (diff)
downloadit-tools-6becdbb42329e1bdecf158707e37ba9f13ba1d2c.tar.gz
it-tools-6becdbb42329e1bdecf158707e37ba9f13ba1d2c.tar.zst
it-tools-6becdbb42329e1bdecf158707e37ba9f13ba1d2c.zip
refactor(config): added config management with figue
Diffstat (limited to 'src/config.ts')
-rw-r--r--src/config.ts53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/config.ts b/src/config.ts
new file mode 100644
index 0000000..a73a916
--- /dev/null
+++ b/src/config.ts
@@ -0,0 +1,53 @@
+import { figue } from 'figue';
+
+export const config = figue({
+ app: {
+ version: {
+ doc: 'Application current version',
+ format: 'string',
+ default: '0.0.0',
+ env: 'PACKAGE_VERSION',
+ },
+ lastCommitSha: {
+ doc: 'Application last commit SHA version',
+ format: 'string',
+ default: '',
+ env: 'VITE_VERCEL_GIT_COMMIT_SHA',
+ },
+ baseUrl: {
+ doc: 'Application base url',
+ format: 'string',
+ default: '/',
+ env: 'BASE_URL',
+ },
+ env: {
+ doc: 'Application current env',
+ format: 'enum',
+ values: ['production', 'development', 'test'],
+ default: 'development',
+ env: 'MODE',
+ },
+ },
+ plausible: {
+ domain: {
+ doc: 'Plausible current domain',
+ format: 'string',
+ default: '',
+ env: 'VITE_PLAUSIBLE_DOMAIN',
+ },
+ apiHost: {
+ doc: 'Plausible remote api host',
+ format: 'string',
+ default: '',
+ env: 'VITE_PLAUSIBLE_API_HOST',
+ },
+ trackLocalhost: {
+ doc: 'Enable or disable localhost tracking by plausible',
+ format: 'boolean',
+ default: false,
+ },
+ },
+})
+ .loadEnv(import.meta.env)
+ .validate()
+ .getConfig();