Skip to main content

Dynamo

Dynamo is a useful configuration library for Deno applications.

Usage

Using Dynamo is very simple.

import * as Dynamo from "https://deno.land/x/dynamo/mod.ts";

interface ApplicationConfig extends Dynamo.Config {
    verbose: boolean;
    port: number;
    hostname: string;
    credentials: {
        username: string;
        password: string;
    };
}

const config = await Dynamo.create<ApplicationConfig>({ file: "./config.yml" });

// reload can be called to reload the config from the filesystem.
await config.reload();

Formats

By default, Dynamo uses YAML for configuration, but it is designed to be extendable. The create method takes an optional parser parameter with the type (content: string) => any. This allows you to use any format you can parse. Dynamo includes extra parsers for different formats in the parsers directory. For example, to use JSON:

import { json } from "https://deno.land/x/dynamo/parsers/json.ts";

const config = await Dynamo.create<ApplicationConfig>({
    file: "./config.json",
    parser: json,
});

To see the full list of parsers, see the parsers directory.

Support

For support, open an issue, or contact me on Discord.

License

Dynamo is licensed under the MIT license.