Compare commits

..
4 Commits
4 changed files with 9 additions and 7 deletions
+1 -1
View File
@@ -46,4 +46,4 @@ COPY --from=builder /tinyauth/tinyauth ./
EXPOSE 3000
CMD ["./tinyauth"]
ENTRYPOINT ["./tinyauth"]
+3 -1
View File
@@ -100,17 +100,19 @@ func HandleError(err error, msg string) {
func init() {
rootCmd.AddCommand(cmd.UserCmd())
viper.AutomaticEnv()
rootCmd.Flags().IntP("port", "p", 3000, "Port to run the server on.")
rootCmd.Flags().Int("port", 3000, "Port to run the server on.")
rootCmd.Flags().String("address", "0.0.0.0", "Address to bind the server to.")
rootCmd.Flags().String("secret", "", "Secret to use for the cookie.")
rootCmd.Flags().String("app-url", "", "The tinyauth URL.")
rootCmd.Flags().String("users", "", "Comma separated list of users in the format username:bcrypt-hashed-password.")
rootCmd.Flags().String("users-file", "", "Path to a file containing users in the format username:bcrypt-hashed-password.")
rootCmd.Flags().Bool("cookie-secure", false, "Send cookie over secure connection only.")
viper.BindEnv("port", "PORT")
viper.BindEnv("address", "ADDRESS")
viper.BindEnv("secret", "SECRET")
viper.BindEnv("app-url", "APP_URL")
viper.BindEnv("users", "USERS")
viper.BindEnv("users-file", "USERS_FILE")
viper.BindEnv("cookie-secure", "COOKIE_SECURE")
viper.BindPFlags(rootCmd.Flags())
}
+4 -4
View File
@@ -76,8 +76,8 @@ var CreateCmd = &cobra.Command{
}
func init() {
CreateCmd.Flags().BoolVarP(&interactive, "interactive", "i", false, "Create a user interactively")
CreateCmd.Flags().BoolVarP(&docker, "docker", "d", false, "Format output for docker")
CreateCmd.Flags().StringVarP(&username, "username", "u", "", "Username")
CreateCmd.Flags().StringVarP(&password, "password", "p", "", "Password")
CreateCmd.Flags().BoolVar(&interactive, "interactive", false, "Create a user interactively")
CreateCmd.Flags().BoolVar(&docker, "docker", false, "Format output for docker")
CreateCmd.Flags().StringVar(&username, "username", "", "Username")
CreateCmd.Flags().StringVar(&password, "password", "", "Password")
}
+1 -1
View File
@@ -73,7 +73,7 @@ var VerifyCmd = &cobra.Command{
}
if docker {
userSplit[1] = strings.ReplaceAll(password, "$$", "$")
userSplit[1] = strings.ReplaceAll(userSplit[1], "$$", "$")
}
verifyErr := bcrypt.CompareHashAndPassword([]byte(userSplit[1]), []byte(password))