Skip to content

Remove env magic #12

@3y3

Description

@3y3

At current time env is accessible everywhere in project (but used only in main module).

Proposal:

  • Disallow env in eslint rules.
  • Add 'resolve-options' helper (allow env here).
  • Add to options all missed entities. For example const appInstallation = process.env.APP_INSTALLATION; can not be configured without env.
  • Reverse default behavior for disableDotEnv
  • Make more options accessible from env

Proposal+:

Looks like options.config is a flat object.
Maybe it should be top level param

constructor(options: InitOptions = {}) {}

constructor(options: InitOptions & AppConfig = {}) {}

So most part of configuration will be accessible from env

# appTracingEnabled
APP_TRACING_ENABLED=false

But I understand problems with appSensitiveKeys in this keys.

Most interested api looks like:

import {NodeKit, configure} from 'nodekit';

const nodekit = new NodeKit(configure({
  env: true,
  file: require.resolve('./config')
}));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    🗃️ Later

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions