]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/core/config/config.service.ts
Add ability to limit user registrations
[github/Chocobozzz/PeerTube.git] / client / src / app / core / config / config.service.ts
CommitLineData
df98563e
C
1import { Injectable } from '@angular/core'
2import { Http } from '@angular/http'
92fb909c 3
df98563e 4import { RestExtractor } from '../../shared/rest'
154898b0 5import { ServerConfig } from '../../../../../shared'
92fb909c
C
6
7@Injectable()
8export class ConfigService {
df98563e 9 private static BASE_CONFIG_URL = API_URL + '/api/v1/config/'
92fb909c 10
154898b0 11 private config: ServerConfig = {
92fb909c 12 signup: {
291e8d3e 13 allowed: false
92fb909c 14 }
df98563e 15 }
92fb909c 16
df98563e 17 constructor (
92fb909c 18 private http: Http,
df98563e 19 private restExtractor: RestExtractor
92fb909c
C
20 ) {}
21
df98563e 22 loadConfig () {
92fb909c
C
23 this.http.get(ConfigService.BASE_CONFIG_URL)
24 .map(this.restExtractor.extractDataGet)
25 .subscribe(data => {
df98563e
C
26 this.config = data
27 })
92fb909c
C
28 }
29
df98563e
C
30 getConfig () {
31 return this.config
92fb909c
C
32 }
33}