Documentation
¶
Index ¶
Constants ¶
const ParserFormat string = "ENV"
ParserFormat defines the standard identifier and file extension target for this provider.
const XERR_PKGCTX_PARSER xerrors.ErrorCode = "XCONFIG.PARSER.DOTENV"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser implements the xconfig.Parser interface to read, tokenize, and ingest standard key-value ".env" configuration files.
func NewParser ¶
func NewParser() *Parser
NewParser instantiates an unconfigured pointer to a Parser.
func (*Parser) Read ¶
Read processes all matched configuration files, parses their text lines sequentially, converts valid assignments into a generic data map, and normalizes key hierarchies.
Parsing features:
- Skips empty lines and comment lines starting with '#'.
- Strips optional POSIX shell "export " statements.
- Trims enclosing single (') or double (") quotes from text values.
- Transforms structural delimiters (e.g., "APP_DB_PORT" with Separator "_" becomes "app.db.port").
Returns a merged generic map of strings, or an error if any file read or scanning operation fails.
func (*Parser) SetOptions ¶
SetOptions executes strict path and naming validations against the incoming criteria. It configuration targets must satisfy single-path exclusivity (File vs Dir vs ConfigPath) and must provide valid Prefix and Separator tokens required for environment variables mapping.