Skip to main content

fromString(params): string

Defined in: src/config-manager/converters.ts:22

Validates a string value for use as an environment variable. Ensures the string meets length requirements (2-100 characters).

Parameters

params

The parameters object

value

string

The string value to validate

variableName

string

The name of the environment variable (used in error messages)

Returns

string

The validated string value

Throws

When the value doesn't meet validation criteria (empty, too short, or too long)

Example

const validated = fromString({
variableName: 'API_KEY',
value: 'abc123xyz'
});
// Returns: "abc123xyz"