-
Notifications
You must be signed in to change notification settings - Fork 1
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
GitEnv 2.0 #4
Labels
Comments
Here is a revised idea for the config and extension files: // --- EnvConfig: gitenvs.config.json --- //
export type PointerOrValue =
| {
type: 'pointer'
fileId: string
stage: string
key: string
}
| {
type: 'value'
value: string
encrypted: boolean
}
export type EnvVar = {
// BASICS:
fileId: string
stage: string
key: string
// Just for DTO. All pointers resolved, funcs have been run & values are decrypted
_value?: string
} & (
| {
type: 'func'
func: {
name: string
params?: Record<string, PointerOrValue | PointerOrValue[]>
}
}
| {
type: 'content'
content: PointerOrValue
}
)
export type EnvFile = {
fileId: string
name: string
path: string
type:
| 'dotenv'
| 'typescript'
// Can be used as a collection of variables. These variables can be reused in real files
// `path` will be ignored.` TODO: Maybe we need better naming
| 'variables'
// Can be extended by extension file -> fileWriters
| string
}
export type EnvStage = {
name: string
publicKey: string
encryptedPrivateKey: string
}
export type EnvConfig = {
version: 1
envVars: EnvVar[]
files: EnvFile[]
stages: EnvStage[]
// extensionsPath: string
} // --- Extension File: gitenvs.extensions.js --- //
export type FuncContext<Params = Record<string, string | string[]>> = {
params: Params
currentEnvVar: EnvVar
}
export type Func<Input> = (options: {
input: Input
context: FuncContext
}) => Promise<string>
export type EnvFileWriter = (options: { TODO: any }) => Promise<string>
export type ExtensionFile = {
funcs: {
[funcName: string]: Func<any>
}
writers: {
[writerName: string]: EnvFileWriter
}
} Some infos why the functions are designed how they are:
|
Nice thing about params for functions is that
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
GitEnv 2.0
UI
.gitenv.config.json
JS
gitenv.config.js
?Tech Stack
https://github.com/t3-oss/create-t3-app
The text was updated successfully, but these errors were encountered: