project-setup-validation-yaml
Version:
Validate environment variables, files and directories. Supports YAML configuration
53 lines (50 loc) • 2.3 kB
YAML
config:
# Configuration (Global settings)
# baseDir [string, optional] - will be used as baseDir for files and dirs that doesn't have individual property 'baseDir' set
#
baseDir: "%CWD%"
environment:
# Environment property
# name [string, required] - name of the environment variable
# type [string, required] - environment variable type
#
# Available environment types:
# str - Passes string values through, will ensure an value is present unless a default value is given. Note that an empty string is considered a valid value - if this is undesirable you can easily create your own validator (see below)
# bool - Parses env var strings "1", "0", "true", "false", "t", "f" into booleans
# num - Parses an env var (eg. "42", "0.23", "1e5") into a Number
# email - Ensures an env var is an email address
# host- Ensures an env var is either a domain name or an ip address (v4 or v6)
# port - Ensures an env var is a TCP port (1-65535)
# url - Ensures an env var is a url with a protocol and hostname
# json - Parses an env var with JSON.parse
# base64Json - (CUSTOM) Parses an env var as base64 and converts to JSON
# base64String - (CUSTOM) Parses an env var as base64 and returns string
#
- name: "EXAMPLE_ENV"
type: "str"
# - name: "TEST"
# type: "url"
# - name: "TEST2"
# type: "json"
# - name: "TEST3"
# type: "base64Json"
files:
# Files property
# path [string, required] - string representation of path to where the file is supposed to be
# ensureExists [bool, optional, default = false] - creates empty file and directory to it if set to true
# baseDir [string, optional, default = ""] - sets individual base directory (ignores global)
#
# - path: "/data/test.js"
# ensureExists: true
# baseDir: "D:/"
dirs:
# Dirs property
# path [string, required] - string representation of path to where the directory is supposed to be
# ensureExists [bool, optional] - creates directories if it doesn't exist
# baseDir [string, optional] - sets individual base directory (ignores global)
#
# - path: "/data/test
# ensureExists: true
# baseDir: "D:/"
# Custom variables
# %CWD% will be replaced with current cwd that the program starts with or can be passed as argument