FsMake


EnvVar Module

Module for working with environment variables.

Types

Type Description

NotFoundException

The exception that is thrown when an environment variable with a given name could not be found.

Functions and values

Function or value Description

get name

Full Usage: get name

Parameters:
    name : string - The name of the env var to get.

Returns: string The value of the env var.

Gets an environment variable by name.

name : string

The name of the env var to get.

Returns: string

The value of the env var.

NotFoundException Thrown when an env var with the specified name does not exist.

getAs name

Full Usage: getAs name

Parameters:
    name : string - The name of the env var to get.

Returns: 'T The converted env var.

Gets an environment variable by name and converts it to the specified type.

name : string

The name of the env var to get.

Returns: 'T

The converted env var.

NotFoundException Thrown when the env var does not exist.
NotSupportedException Thrown when the env var cannot be converted to the specified type.

getAsOrFail name

Full Usage: getAsOrFail name

Parameters:
    name : string - The name of the env var to get.

Returns: Make<'T> The env var if it exists and can be converted, an Error if it does not or cannot be converted.

Gets an environment variable by name and converts it to the specified type.

This creates a Make that can be used in a step. When unable to get the env var, the step will fail.

name : string

The name of the env var to get.

Returns: Make<'T>

The env var if it exists and can be converted, an Error if it does not or cannot be converted.

Example

 let getMyBool = EnvVar.getAsOrFail<bool> "MY_BOOL"

 let step = Step.create "release-notes" {
     let! myBool = getMyBool
     ...
 }

getOption name

Full Usage: getOption name

Parameters:
    name : string - The name of the env var to get.

Returns: Option<string> Some if env var exists, None if it does not exist.

Gets an environment variable by name.

name : string

The name of the env var to get.

Returns: Option<string>

Some if env var exists, None if it does not exist.

getOptionAs name

Full Usage: getOptionAs name

Parameters:
    name : string - The name of the env var to get.

Returns: 'T option Some if the env var exists and can be converted, None if it does not exist or cannot be converted.

Gets an environment variable by name and converts it to the specified type.

name : string

The name of the env var to get.

Returns: 'T option

Some if the env var exists and can be converted, None if it does not exist or cannot be converted.

getOrFail name

Full Usage: getOrFail name

Parameters:
    name : string - The name of the env var to get.

Returns: Make<string> The env var if it exists, or an Error if it does not.

Gets an environment variable by name.

This creates a Make that can be used in a step. When unable to get the env var, the step will fail.

name : string

The name of the env var to get.

Returns: Make<string>

The env var if it exists, or an Error if it does not.

Example

 let getToken = EnvVar.getOrFail "GITHUB_TOKEN"

 let step = Step.create "release-notes" {
     let! token = getToken
     ...
 }

set (arg1, arg2)

Full Usage: set (arg1, arg2)

Parameters:
    arg0 : string
    arg1 : string

Sets the specified environment variable.

arg0 : string
arg1 : string

setMany envVars

Full Usage: setMany envVars

Parameters:
    envVars : seq<string * string> - A seq of pairs representing the names and values of the environment variables.

Sets the specified seq of environment variables.

envVars : seq<string * string>

A seq of pairs representing the names and values of the environment variables.