From 6946659c3b8356c00dd7423f9f28a7bca37c8b63 Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Wed, 29 Nov 2017 12:56:11 +0100 Subject: [PATCH] Use keyType during key generation to create correct key type Change-Type: patch Connects-To: #27 Signed-off-by: Andreas Fitzek --- resin/main.go | 5 +---- sshproxy.go | 2 +- versionist.conf.js | 24 ++++++++++++++++-------- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/resin/main.go b/resin/main.go index 194abba..8c49b1c 100644 --- a/resin/main.go +++ b/resin/main.go @@ -92,10 +92,7 @@ func init() { if err := viper.BindEnv("allow-env", "SSHPROXY_ALLOW_ENV"); err != nil { return err } - if err := viper.BindEnv("sentry-dsn", "SSHPROXY_SENTRY_DSN"); err != nil { - return err - } - return nil + return viper.BindEnv("sentry-dsn", "SSHPROXY_SENTRY_DSN") }() if err != nil { log.Fatal("Initialisation failed", err) diff --git a/sshproxy.go b/sshproxy.go index 7a50e62..0bb2a88 100644 --- a/sshproxy.go +++ b/sshproxy.go @@ -93,7 +93,7 @@ func (s *Server) addHostKey(keyType string) error { } // generate ssh server keys log.Printf("Generating private key... (%s)", keyType) - err := exec.Command("ssh-keygen", "-f", keyPath, "-t", "rsa", "-N", "").Run() + err := exec.Command("ssh-keygen", "-f", keyPath, "-t", keyType, "-N", "").Run() if err != nil { return err } diff --git a/versionist.conf.js b/versionist.conf.js index 8954c68..32c47b4 100644 --- a/versionist.conf.js +++ b/versionist.conf.js @@ -1,8 +1,16 @@ -var execSync = require('child_process').execSync; +'use strict'; -var getAuthor = (commitHash) => { - return execSync(`git show --quiet --format="%an" ${commitHash}`, { encoding: 'utf8' }).replace('\n', ''); -} +const execSync = require('child_process').execSync; + +const getAuthor = (commitHash) => { + return execSync(`git show --quiet --format="%an" ${commitHash}`, { + encoding: 'utf8' + }).replace('\n', ''); +}; + +const isIncrementalCommit = (changeType) => { + return Boolean(changeType) && changeType.trim().toLowerCase() !== 'none'; +}; module.exports = { // This setup allows the editing and parsing of footer tags to get version and type information, @@ -12,7 +20,7 @@ module.exports = { parseFooterTags: true, getGitReferenceFromVersion: 'v-prefix', incrementVersion: 'semver', - updateVersion: (cwd, version, cb) => { cb(); }, + editVersion: false, // Always add the entry to the top of the Changelog, below the header. addEntryToChangelog: { @@ -23,14 +31,14 @@ module.exports = { // Only include a commit when there is a footer tag of 'change-type'. // Ensures commits which do not up versions are not included. includeCommitWhen: (commit) => { - return !!commit.footer['change-type']; + return isIncrementalCommit(commit.footer['change-type']); }, // Determine the type from 'change-type:' tag. // Should no explicit change type be made, then no changes are assumed. getIncrementLevelFromCommit: (commit) => { - if (commit.footer['change-type']) { - return commit.footer['change-type'].trim(); + if (isIncrementalCommit(commit.footer['change-type'])) { + return commit.footer['change-type'].trim().toLowerCase(); } },