moonfig

    A native configuration library for MoonBit: declare once, gather from many sources.

    config
    configuration
    settings
    merge
    json
    yaml
    toml
    xml
    ini
    env
    cbor
    Download zip
    Author
    Version
    0.2.1
    License
    Apache-2.0
    Last updated
    16 hours ago
    Downloads
    211

    #moonfig

    A native configuration library for MoonBit: declare once, gather from many sources.

    This is the core module. It contains the sources, merging, the JSON / INI / .env formats, format detection, hot reload, validation and the extraction paths that need no third-party parser. TOML, YAML, XML, CBOR and serde ship as separate modules, so adding moonfig does not pull in a parser you do not use.

    #Install

    moon add MuVirus/moonfig

    import {
    "MuVirus/moonfig/core" @config,
    "MuVirus/moonfig/core/format/json_format" @jsonfmt,
    }

    #Packages

    PackageContents
    coreValue, Config, merge rules, extraction, validation
    core/format/json_formatJSON text → Value
    core/format/ini_formatINI text → Value
    core/format/dotenv_format.env text → Value
    file_sourceread a file through a Format
    env_sourceprocess environment variables
    cli_sourcecommand-line arguments
    format_detectsuffix first, content sniffing second
    hot_reloadpoll files and replace the snapshot

    #Optional adapters

    You readAdd
    TOMLmoon add MuVirus/moonfig-toml
    YAMLmoon add MuVirus/moonfig-yaml
    XMLmoon add MuVirus/moonfig-xml
    CBORmoon add MuVirus/moonfig-cbor
    serde-based extractionmoon add MuVirus/moonfig-serde