mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-20 23:06:14 -04:00
refactor(config): added config management with figue
This commit is contained in:
parent
5ce1262fb4
commit
6becdbb423
7 changed files with 82 additions and 12 deletions
53
src/config.ts
Normal file
53
src/config.ts
Normal file
|
@ -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();
|
Loading…
Add table
Add a link
Reference in a new issue