mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 11:30:13 +08:00
refactor utils
This commit is contained in:
1 parent
9509bbc355
commit
d6c95cea4a
13 files changed
+126
-31
No files matched your search
@@ -0,0 +1,10 @@
|
||||
import crypto from 'crypto'
|
||||
|
||||
export function get<T>(key: string, defaultValue: T): T {
|
||||
const value = process.env[key]
|
||||
return value !== undefined ? (value as unknown as T) : defaultValue
|
||||
}
|
||||
|
||||
export function genSecret() {
|
||||
return crypto.randomUUID()
|
||||
}
|
||||
Reference in new issue
Block a user