mirror of
https://github.com/OutlineFoundation/outline-server.git
synced 2026-08-04 14:37:34 +00:00
Make single port driven by rollout
This commit is contained in:
parent
5eda24d0b9
commit
2ae5b49071
2 changed files with 9 additions and 1 deletions
|
|
@ -176,6 +176,9 @@ async function main() {
|
|||
|
||||
const accessKeyRepository = new ServerAccessKeyRepository(
|
||||
portProvider, proxyHostname, accessKeyConfig, shadowsocksServer);
|
||||
if (createRolloutTracker(serverConfig).isRolloutEnabled('single-port', 0)) {
|
||||
accessKeyRepository.enableSinglePort();
|
||||
}
|
||||
|
||||
const prometheusClient = new PrometheusClient(`http://${prometheusLocation}`);
|
||||
const metricsReader = new PrometheusUsageMetrics(prometheusClient);
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ function makeAccessKey(hostname: string, accessKeyJson: AccessKeyConfig): Access
|
|||
export class ServerAccessKeyRepository implements AccessKeyRepository {
|
||||
// This is the max id + 1 among all access keys. Used to generate unique ids for new access keys.
|
||||
private NEW_USER_ENCRYPTION_METHOD = 'chacha20-ietf-poly1305';
|
||||
private singlePortEnabled = false;
|
||||
|
||||
constructor(
|
||||
private portProvider: PortProvider, private proxyHostname: string,
|
||||
|
|
@ -77,8 +78,12 @@ export class ServerAccessKeyRepository implements AccessKeyRepository {
|
|||
this.updateServer();
|
||||
}
|
||||
|
||||
enableSinglePort() {
|
||||
this.singlePortEnabled = true;
|
||||
}
|
||||
|
||||
async createNewAccessKey(): Promise<AccessKey> {
|
||||
const port = await this.getDefaultPort();
|
||||
const port = await (this.singlePortEnabled ? this.getDefaultPort() : this.portProvider.reserveNewPort());
|
||||
const id = this.keyConfig.data().nextId.toString();
|
||||
this.keyConfig.data().nextId += 1;
|
||||
const metricsId = uuidv4();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue