Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

593 B
Raw Blame
package main

import (
	"fmt"
	"io"
	"os"

	"github.com/rcourtman/pulse-go-rewrite/pkg/auth"
)

var (
	hashPassword           = auth.HashPassword
	osArgs                 = os.Args
	osExit                 = os.Exit
	stdout       io.Writer = os.Stdout
)

func run(args []string, out io.Writer) int {
	if len(args) < 2 {
		fmt.Fprintln(out, "Usage: hashpw <password>")
		return 1
	}

	password := args[1]
	hash, err := hashPassword(password)
	if err != nil {
		fmt.Fprintf(out, "Error: %v\n", err)
		return 1
	}

	fmt.Fprintln(out, hash)
	return 0
}

func main() {
	osExit(run(osArgs, stdout))
}