Socket
Book a DemoInstallSign in
Socket

@cloudaffine/app-config

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cloudaffine/app-config

Application properties/json/yaml config like Spring boot does. Integrated with Angular and NestJS

0.3.0
latest
Source
npmnpm
Version published
Weekly downloads
0
-100%
Maintainers
1
Weekly downloads
 
Created
Source

App config service for Angular and NestJS

Install

npm i @cloudaffine/app-config

Angular

In your AppModule

import { ConfigModule } from '@cloudaffine/app-config/angular';
import { APP_INITIALIZER } from '@angular/core';

@NgModule({
    imports: [
        ConfigModule.forRoot({
            browser: {
                url: '/config.json'
            },
            server: {
                paths: ['./config.yaml']
            }
        })
    ],
    providers: [
        {
            provide: APP_INITIALIZER
            useFactory: ConfigModule.initializer,
            multi: true
        }
    ]
})
export class AppModule {}

Then in your service or component, optional you can specify a type as the config schema.

@Injectable()
export class SomeService {
    constructor(private configService: ConfigService<any>) {}

    func() {
        const aa = this.configService.config.aa;
    }
}

NestJS

In your AppModule

imort { ConfigModule } from '@cloudaffine/app-config/nestjs';

@Module({
    imports: [
        ConfigModule.forRoot({
            paths: ['./config.yaml']
        })
    ]
})
export class AppModule {}

Then in your service or component, optional you can specify a type as the config schema.

@Injectable()
export class SomeService {
    constructor(private configService: ConfigService<any>) {}

    func() {
        const aa = this.configService.config.aa;
    }
}

Keywords

application.properties

FAQs

Package last updated on 26 Mar 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.