package config

import (
	"golang.org/x/crypto/bcrypt"
)

func getBcryptHash(input string) string {
	hashedPassword, err := bcrypt.GenerateFromPassword([]byte(input), bcrypt.DefaultCost)
	if err != nil {
		panic(err)
	}
	return string(hashedPassword)
}

func generateCreds(config *Config) {
	config.Modules.Cicd.ArgoCd.AdminPassword = getBcryptHash(config.Modules.AdminPassword)
	config.Modules.Registry.AdminPassword = config.Modules.AdminPassword
}
