Skip to main content

Açai Config Module

Build Status Support

Açai config module is a small tool that helps you handle data inside of your application. It exports a global config by default, and an option to create a scoped config.

Usage

import config from "https://deno.land/x/acai_config/mod.ts";

// access your env variables with
console.log(config.env);
// or
console.log(config.getEnv("key"));

// you can access your config with
console.log(config.config);
// or
console.log(config.getConfig("key"));

// you can also set a config with
config.setConfig("key", "value");

If you wish to bind your env variables with your config variables, you can call config.fetchEnv(undefined, true), this will store all your env variables inside of the config.

Optional envs

By default, config will try to fetch from .env, but you can pass a preset to try. If not found, it will alert on the console and try to fetch .env instead.

import config from "https://deno.land/x/acai_config/mod.ts";

// will fetch env from .env.testing
config.fetchEnv("testing");
// will fetch env from .env.production
config.fetchEnv("production");