Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mvplus-dynamic-configuration-lib

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mvplus-dynamic-configuration-lib

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 6.2.5.

  • 1.6.1
  • latest
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

MvplusDynamicConfigurationLibApp

This project was generated with Angular CLI version 6.2.5.

Support

  • Angular version >=5.0.0
  • Rxjs@ version >=5.0.0

Upgrade version of npm plugin

Change manually the version in projects/mvplus-dynamic-configuration-lib/package.json

Build package

npm run package

Publish on npm

npm login

npm publish dist/mvplus-dynamic-configuration-lib/mvplus-dynamic-configuration-lib-${your-version}.tgz

Usage

Import MvplusDynamicConfigurationLibModule in your app (or core if you have) module, calling forRoot method :

Example core.module.ts

@NgModule({
    imports: [
        BrowserModule,
        CommonModule,
        LeafletModule.forRoot(),
        HttpClientModule,
        MvplusDynamicConfigurationLibModule.forRoot({ //You need to match with BackendConf class constructor
            endpoints: [ 
                { name: 'dev', value: 'http://dev.virt.moviplus.ch:8083/tpc_app_clients' },
                { name: 'demo', value: 'http://demo.virt.moviplus.ch:8085/tpc_app_clients' }
            ],
            activeEndpoint: { name: 'dev', value: 'http://demo.virt.moviplus.ch:8083/tpc_app_clients' }
        })
    ],
    providers: [],
    exports: [MvplusDynamicConfigurationLibModule]
})

You can see class definitions below.

Then use the component in the view :

<mvplus-configuration-selector [buttonText]="'Open'" [customBtnClass]="['btn']"></mvplus-configuration-selector>
Input properties

buttonText type string, default value : 'Ouvrir'

customBtnClass type string[], default value : []

forRoot options

endpoints

This is an array of EndpointConfiguration (see impl. below), which appear to the dropdown of backend endpoint choice.

activeEndpoint

This is a representation of EndpointConfiguration (see impl. below), which is the default backend endpoint.

Usage of dynamic backend in code

You must inject BackendConfigService to have access to current active endpoint.

Example

@Injectable()
export class SigninService {
    constructor(
        private http: HttpClient,
        private authenticationService: AuthenticationService,
        private backendConfigurationService: BackendConfigService) {
    }

    public $signin(login: string, password: string): Observable<UserResponse> {
        const params: SigninParams = {
            login: login,
            password: password
        };
        const body: HttpParams = new HttpParams({ fromObject: params });
        return this.http
            .post<UserResponse>(`${this.backendConfigurationService.getBackend().value}/signin.cms.json`, body);
    }
}

Implementation of the configuration

BackendConfig

class BackendConfig {
  constructor(public endpoints: EndpointConfiguration[] = [], public activeEndpoint: EndpointConfiguration = null) {
  }
}

EndpointConfiguration

interface EndpointConfiguration {
  value: string;
  name: string;
  version: string;
}

Changelog

v1.6.1 (11.12.18)

  • New method in BackendConfigurationService to build the URL directly, with optional parameters to include version of api in the url.

v1.6.0 (11.12.18)

  • Add API version in `EndpointConfiguration

v1.5.9 (29.10.18)

  • Remove "Close" button
  • Update readme

v1.5.8 (29.10.18)

  • You can change the label of the button by input [buttonText] of string type
  • You can change the css style of the button by input [customBtnClass] of string[] type

FAQs

Package last updated on 11 Dec 2018

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc