From 9eae9dcee348d270a35da415151e286c0bb38bf1 Mon Sep 17 00:00:00 2001 From: Michel Wohlert Date: Mon, 8 Jul 2019 18:04:33 +0200 Subject: [PATCH] Add os.sshKeys to generateBaseConfig Change-type: minor --- lib/utils/config.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/utils/config.ts b/lib/utils/config.ts index a7be3c36..4a25b0ab 100644 --- a/lib/utils/config.ts +++ b/lib/utils/config.ts @@ -46,6 +46,10 @@ interface ImgConfig { deviceId?: number; uuid?: string; registered_at?: number; + + os?: { + sshKeys?: string[]; + }; } export function generateBaseConfig( @@ -54,6 +58,9 @@ export function generateBaseConfig( version: string; appUpdatePollInterval?: number; deviceType?: string; + os?: { + sshKeys?: string[]; + } }, ): Promise { options = { @@ -68,6 +75,15 @@ export function generateBaseConfig( return promise.tap(config => { // os.getConfig always returns a config for an app delete config.apiKey; + + // merge sshKeys to config, when they have been specified + if(options.os && options.os.sshKeys) { + // Create config.os object if it does not exist + config.os = config.os ? config.os : {}; + config.os.sshKeys = config.os.sshKeys + ? [...config.os.sshKeys, ...options.os.sshKeys] + : options.os.sshKeys; + } }); }