Repository navigation
modules_config
Rafael Corrêa Chaves edited this page Jul 18, 2021
·
2 revisions
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.
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.
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");Copyright (c) 2021 APO Softworks. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.