mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-18 16:02:10 +00:00
b4ed0ecd03
* feat: wmil sync for users and groups * fix: sort admins * fix: sqlx build * chore: update to latest deno client
42 lines
959 B
TypeScript
42 lines
959 B
TypeScript
import { yamlParse } from "./deps.ts";
|
|
|
|
export interface SyncOptions {
|
|
stateful?: boolean;
|
|
raw?: boolean;
|
|
yes?: boolean;
|
|
skipPull?: boolean;
|
|
failConflicts?: boolean;
|
|
plainSecrets?: boolean;
|
|
json?: boolean;
|
|
skipVariables?: boolean;
|
|
skipResources?: boolean;
|
|
skipSecrets?: boolean;
|
|
includeSchedules?: boolean;
|
|
includeUsers?: boolean;
|
|
includeGroups?: boolean;
|
|
message?: string;
|
|
includes?: string[];
|
|
extraIncludes?: string[];
|
|
excludes?: string[];
|
|
defaultTs?: "bun" | "deno";
|
|
}
|
|
|
|
export async function readConfigFile(): Promise<SyncOptions> {
|
|
try {
|
|
const conf = yamlParse(
|
|
await Deno.readTextFile("wmill.yaml")
|
|
) as SyncOptions;
|
|
|
|
return typeof conf == "object" ? conf : ({} as SyncOptions);
|
|
} catch (e) {
|
|
return {};
|
|
}
|
|
}
|
|
|
|
export async function mergeConfigWithConfigFile<T>(
|
|
opts: T
|
|
): Promise<T & SyncOptions> {
|
|
const configFile = await readConfigFile();
|
|
return Object.assign(configFile, opts);
|
|
}
|