Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jupegarnica/garn-yaml

read or write yaml interpolating env variables
https://github.com/jupegarnica/garn-yaml

Last synced: 18 days ago
JSON representation

read or write yaml interpolating env variables

Awesome Lists containing this project

README

        

gar-yaml: read or write yaml interpolating env variables

[deno.land/x/garn-yaml](https://deno.land/x/garn_yaml)

![Test](https://github.com/jupegarnica/garn-yaml/workflows/Test/badge.svg)

Usage

```yaml
# read.yml
DENO_ENV: ${{DENO_ENV}}
```

```ts
// read.ts
import { readYaml } from 'https://deno.land/x/[email protected]/mod.ts';
import { assertEquals } from 'https://deno.land/[email protected]/testing/asserts.ts';

const yamlObject = await readYaml('./read.yml');
assertEquals(typeof yamlObject, 'object');
assertEquals(yamlObject.DENO_ENV, 'development');
```

```bash
DENO_ENV=development deno run read.ts --allow-read --allow-env
```

```ts
// write.ts
import { writeYaml } from 'https://deno.land/x/[email protected]/mod.ts';

const yamlText = await writeYaml('./write.yml', { a: 1 }); // a: 1
```

```yaml
# write.yml
a: 1
```