1
0
Fork 0

fix: use built in schema when executing container command

This commit is contained in:
Sean Sube 2022-02-23 22:03:20 -06:00
parent 59f8d9cc7e
commit 5768224b72
3 changed files with 11 additions and 1 deletions

View File

@ -7,6 +7,7 @@ RUN apk add --update jq \
ENV PATH="${PATH}:$(yarn global bin)"
WORKDIR /salty-dog
ENV SALTY_DOG_SCHEMA /salty-dog/rules/salty-dog.yml
# copy config, which changes rarely
COPY docs/config-docker.yml /root/.salty-dog.yml

View File

@ -8,6 +8,7 @@ RUN apt-get update -y \
ENV PATH="${PATH}:$(yarn global bin)"
WORKDIR /salty-dog
ENV SALTY_DOG_SCHEMA /salty-dog/rules/salty-dog.yml
# copy config, which changes rarely
COPY docs/config-docker.yml /root/.salty-dog.yml

View File

@ -237,8 +237,16 @@ export async function resolveRules(rules: Array<Rule>, selector: RuleSelector):
return Array.from(activeRules);
}
export function getSchemaPath(): string {
if (doesExist(process.env.SALTY_DOG_SCHEMA)) {
return process.env.SALTY_DOG_SCHEMA;
} else {
return join(dirName(), 'rules', 'salty-dog.yml');
}
}
export function loadSchema(): any {
const path = join(dirName(), 'rules', 'salty-dog.yml');
const path = getSchemaPath();
const data = readFileSync(path, { encoding: 'utf-8' });
if (doesExist(data)) {