Load test configs when running tests
This commit is contained in:
parent
3f9dad8f9a
commit
07f881d543
11
config.ts
11
config.ts
@ -3,16 +3,21 @@ import { parse as parseYaml } from "jsr:@std/yaml";
|
||||
import { checkFileExists } from "./utils.ts";
|
||||
import { log } from "./log.ts";
|
||||
|
||||
const denoEnv = Deno.env.get("DENO_ENV");
|
||||
const dirname = Deno.cwd();
|
||||
|
||||
await load({ envPath: `${dirname}/.env`, export: true });
|
||||
function envAwarePath(path: string): string {
|
||||
return denoEnv ? `${path}.${denoEnv}` : path;
|
||||
}
|
||||
|
||||
await load({ envPath: envAwarePath(`${dirname}/.env`), export: true });
|
||||
|
||||
let userConfigPath: string = "";
|
||||
let staticUsers: { [key: string]: string } = {};
|
||||
|
||||
const defaultUserConfigPaths = [
|
||||
"/etc/substr/users.yaml",
|
||||
`${dirname}/users.yaml`,
|
||||
envAwarePath("/etc/substr/users.yaml"),
|
||||
envAwarePath(`${dirname}/users.yaml`),
|
||||
];
|
||||
|
||||
for (const path of defaultUserConfigPaths) {
|
||||
|
3
users.yaml.test
Normal file
3
users.yaml.test
Normal file
@ -0,0 +1,3 @@
|
||||
_: b3e1b7c0ef48294bd856203bfd460625de95d3afb894e5f09b14cd1f0e7097cf
|
||||
accounts: b3e1b7c1660b7db0ecb93ec55c09e67961171a5c4e9e2602f1b47477ea61c50a
|
||||
raucao: 1f79058c77a224e5be226c8f024cacdad4d741855d75ed9f11473ba8eb86e1cb
|
Loading…
x
Reference in New Issue
Block a user