con2 / con2/emrichen

Typecasting?

Open
#49 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
110
Forks
9
PR merge metrics
No merged PRs in 30d

Description

I ran into an issue where I was trying to make a kubernetes manifest for a volumeMount and I wanted to make it configurable whether or not the volume was readOnly. I'm just using `--include-env` which means that when I provide the environment variable `false` it gets turned into the string `'false'`.

I ended up doing

```
!Defaults
read_only_bool: !Op [!Var read_only, eq, 'true']
```

But it seems like it would be nice to have like a

```
read_only_bool: !Coerce [Boolean, !Var read_only]
```

That could apply standard yaml type guessing to the string and throw an error if it wasn't right (e.g. if you provided read_only=5 that would be a number and so would throw an error, or if you Coerced to numeric then you would end up with an error if you provided the string 'false'.)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.