Add privkey flag
This commit is contained in:
parent
d4a0f483df
commit
dfd3e4fd63
|
@ -43,6 +43,7 @@ func logMiddleware(h http.HandlerFunc) http.HandlerFunc {
|
||||||
func main() {
|
func main() {
|
||||||
listenAddr := flag.String("listen", ":1612", "HTTP listen address")
|
listenAddr := flag.String("listen", ":1612", "HTTP listen address")
|
||||||
debPath := flag.String("debpath", "debs", "Path to directory containing deb files.")
|
debPath := flag.String("debpath", "debs", "Path to directory containing deb files.")
|
||||||
|
privKey := flag.String("privkey", "privkey.gpg", "Path to private key file. Will be created if it doesn't exist")
|
||||||
httpUser := flag.String("httpuser", "debanator", "Username for HTTP basic auth")
|
httpUser := flag.String("httpuser", "debanator", "Username for HTTP basic auth")
|
||||||
httpPass := flag.String("httppass", "", "Enable HTTP basic auth with this password")
|
httpPass := flag.String("httppass", "", "Enable HTTP basic auth with this password")
|
||||||
showVersion := flag.Bool("version", false, "Show version")
|
showVersion := flag.Bool("version", false, "Show version")
|
||||||
|
@ -58,11 +59,11 @@ func main() {
|
||||||
"commit": debanator.Commit,
|
"commit": debanator.Commit,
|
||||||
}).Info("Starting debanator...")
|
}).Info("Starting debanator...")
|
||||||
var ecKey *crypto.Key
|
var ecKey *crypto.Key
|
||||||
kb, err := os.ReadFile("privkey.gpg")
|
kb, err := os.ReadFile(*privKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Infof("Generating new key...")
|
log.Infof("Generating new key...")
|
||||||
ecKey = debanator.Unwrap(crypto.GenerateKey("Debanator", "packager@example.com", "x25519", 0))
|
ecKey = debanator.Unwrap(crypto.GenerateKey("Debanator", "packager@example.com", "x25519", 0))
|
||||||
f := debanator.Unwrap(os.Create("privkey.gpg"))
|
f := debanator.Unwrap(os.Create(*privKey))
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
armored := debanator.Unwrap(ecKey.Armor())
|
armored := debanator.Unwrap(ecKey.Armor())
|
||||||
f.WriteString(armored)
|
f.WriteString(armored)
|
||||||
|
|
Loading…
Reference in New Issue