Extract DatabaseConfig, RedisConfig, RustFSConfig, LogConfig, and EmailConfig from the main Config to enable pkg/* package constructors to receive specific config types by value, supporting the fx.Lifecycle OnStop hooks pattern.
22 lines
300 B
Go
22 lines
300 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"carrotskin/pkg/auth"
|
|
)
|
|
|
|
func main() {
|
|
if len(os.Args) < 2 {
|
|
fmt.Fprintln(os.Stderr, "usage: genhash <password>")
|
|
os.Exit(2)
|
|
}
|
|
h, err := auth.HashPassword(os.Args[1])
|
|
if err != nil {
|
|
fmt.Fprintln(os.Stderr, "err:", err)
|
|
os.Exit(1)
|
|
}
|
|
fmt.Print(h)
|
|
}
|