refactor(core): Store SSH key pair for source control in DB settings (#8965)
This commit is contained in:
@@ -28,7 +28,8 @@ export class SourceControlController {
|
||||
@Get('/preferences', { middlewares: [sourceControlLicensedMiddleware], skipAuth: true })
|
||||
async getPreferences(): Promise<SourceControlPreferences> {
|
||||
// returns the settings with the privateKey property redacted
|
||||
return this.sourceControlPreferencesService.getPreferences();
|
||||
const publicKey = await this.sourceControlPreferencesService.getPublicKey();
|
||||
return { ...this.sourceControlPreferencesService.getPreferences(), publicKey };
|
||||
}
|
||||
|
||||
@Post('/preferences', { middlewares: [sourceControlLicensedMiddleware] })
|
||||
@@ -238,7 +239,8 @@ export class SourceControlController {
|
||||
try {
|
||||
const keyPairType = req.body.keyGeneratorType;
|
||||
const result = await this.sourceControlPreferencesService.generateAndSaveKeyPair(keyPairType);
|
||||
return result;
|
||||
const publicKey = await this.sourceControlPreferencesService.getPublicKey();
|
||||
return { ...result, publicKey };
|
||||
} catch (error) {
|
||||
throw new BadRequestError((error as { message: string }).message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user