1.0.6 • Published 1 year ago

@flexent/config v1.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Configuration Microframework

Declarative configuration framework for Mesh IoC.

Highlights

  • 🔥 Zero dependencies
  • 🗜 Tidy and compact
  • 💻 Works in browser
  • 🔬 Strongly typed and introspectable
  • 🌳 Ergonomic

Usage

  1. Define and use configs in your classes:
export class MyDatabase {
    @config() DATABASE_USERNAME!: string;
    @config() DATABASE_PASSWORD!: string;
    @config({ default: 10 }) DATABASE_MAX_CONNECTIONS!: number;

    async connect() {
        await this.db.connect({
            username: this.DATABASE_USERNAME,
            password: this.DATABASE_PASSWORD,
            maxConnections: this.DATABASE_MAX_CONNECTIONS,
        });
    }
}
  1. Define Config provider in Mesh:
mesh.service(MyDatabase);
mesh.service(Config, ProcessEnvConfig);
  1. Now DATABASE_* values will be read from process.env.

  2. Enjoy!

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago