OWASP / OWASP/cornucopia

Ensure decks.yaml is readable as config

Open
#3,477 2 comments 0 reactions 1 assignee Claimed by @Adarshkumar0509 View on GitHub
help wanted javascript
Dominant language
Python
Stars
146
Forks
97
Avg merge
1d 8h
Merged PRs (30d)
103

Description

The current config: https://github.com/OWASP/cornucopia/blob/master/cornucopia.owasp.org/decks.yaml

should be read in as a config.js file in order to be able to use it from anywhere in svelte.

// src/lib/config.js

import yaml from 'yaml';
import yamlText from '$lib/../../decks.yaml?raw';

// Export the native object structure
export const config = yaml.parse(yamlText);
export const decks = config.decks;

then it can be read in here: https://github.com/OWASP/cornucopia/blob/55730310ff0f238e541040647ffe630e4d42a923/cornucopia.owasp.org/src/lib/services/deckConfigService.ts#L2

like this:

import { deckConfig } from '$lib/config';

or from anywhere in the code where it is needed.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.