* Set a deepstream option. For a list of all available options * please see default-options.
(key: string, value: any)
| 98 | * please see default-options. |
| 99 | */ |
| 100 | public set (key: string, value: any): any { |
| 101 | if (this.currentState === STATES.STOPPED) { |
| 102 | this.overrideSettings.push({ key, value }) |
| 103 | return |
| 104 | } |
| 105 | |
| 106 | if (key === 'storageExclusion') { |
| 107 | throw new Error('storageExclusion has been replace with record.storageExclusionPrefixes instead, which is an array of prefixes') |
| 108 | } |
| 109 | |
| 110 | if (key === 'auth') { |
| 111 | throw new Error('auth has been replaced with authentication') |
| 112 | } |
| 113 | |
| 114 | if (key === 'authentication') { |
| 115 | this.services.authentication = new CombineAuthentication(value instanceof Array ? value : [value]) |
| 116 | return |
| 117 | } |
| 118 | |
| 119 | if ((this.services as any)[key] !== undefined) { |
| 120 | (this.services as any)[key] = value |
| 121 | } else if (getValue(this.config, key) !== undefined) { |
| 122 | setValue(this.config, key, value) |
| 123 | } else { |
| 124 | throw new Error(`Unknown option or service "${key}"`) |
| 125 | } |
| 126 | return this |
| 127 | } |
| 128 | |
| 129 | /** |
| 130 | * Returns true if the deepstream server is running, otherwise false |
no test coverage detected