1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

feat: add method for migrating proxies without environment validation (#2056)

This commit is contained in:
Fredrik Strand Oseberg 2022-09-12 15:22:23 +02:00 committed by GitHub
parent e6e6da6a44
commit 721cd20b5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -171,6 +171,18 @@ export class ApiTokenService {
return this.insertNewApiToken(createNewToken);
}
// TODO: Remove this service method after embedded proxy has been released in
// 4.16.0
public async createMigratedProxyApiToken(
newToken: Omit<IApiTokenCreate, 'secret'>,
): Promise<IApiToken> {
validateApiToken(newToken);
const secret = this.generateSecretKey(newToken);
const createNewToken = { ...newToken, secret };
return this.insertNewApiToken(createNewToken);
}
private async insertNewApiToken(
newApiToken: IApiTokenCreate,
): Promise<IApiToken> {