<commit_before>package main

import (
	"flag"
	"fmt"
	"net/http"
	"os"

	"github.com/gorilla/mux"
	"github.com/gorilla/securecookie"
	"github.com/pivotal-golang/lager"
	"github.com/robdimsdale/garagepi/door"
	"github.com/robdimsdale/garagepi/filesystem"
	"github.com/robdimsdale/garagepi/gpio"
	"github.com/robdimsdale/garagepi/handler"
	"github.com/robdimsdale/garagepi/homepage"
	"github.com/robdimsdale/garagepi/light"
	"github.com/robdimsdale/garagepi/logger"
	"github.com/robdimsdale/garagepi/login"
	gpos "github.com/robdimsdale/garagepi/os"
	"github.com/robdimsdale/garagepi/static"
	"github.com/robdimsdale/garagepi/webcam"
	"github.com/tedsuo/ifrit"
	"github.com/tedsuo/ifrit/grouper"
)

var (
	// version is deliberately left uninitialized so it can be set at compile-time
	version string

	webcamHost = flag.String("webcamHost", "localhost", "Host of webcam image.")
	webcamPort = flag.Uint("webcamPort", 8080, "Port of webcam image.")

	gpioDoorPin  = flag.Uint("gpioDoorPin", 17, "Gpio pin of door.")
	gpioLightPin = flag.Uint("gpioLightPin", 2, "Gpio pin of light.")

	logLevel = flag.String("logLevel", string(logger.INFO), "log level: debug, info, error or fatal")

	enableHTTP  = flag.Bool("enableHTTP", true, "Enable HTTP traffic.")
	enableHTTPS = flag.Bool("enableHTTPS", false, "Enable HTTPS traffic.")
	forceHTTPS  = flag.Bool("forceHTTPS", false, "Redirect all HTTP traffic to HTTPS.")

	httpPort     = flag.Uint("httpPort", 13080, "Port on which to listen for HTTP (if enabled)")
	httpsPort    = flag.Uint("httpsPort", 13433, "Port on which to listen for HTTP (if enabled)")
	redirectPort = flag.Uint("redirectPort", 13443, "Port to which HTTP traffic is redirected (if forceHTTPS is enabled).")

	certFile = flag.String("certFile", "", "A PEM encoded certificate file.")
	keyFile  = flag.String("keyFile", "", "A PEM encoded private key file.")
	caFile   = flag.String("caFile", "", "A PEM encoded CA's certificate file.")

	username = flag.String("username", "", "Username for HTTP authentication.")
	password = flag.String("password", "", "Password for HTTP authentication.")

	dev = flag.Bool("dev", false, "Development mode; do not require username/password")
)

func main() {
	if version == "" {
		version = "dev"
	}

	if len(os.Args) > 1 {
		arg := os.Args[1]
		if arg == "version" || arg == "-v" || arg == "--version" {
			fmt.Printf("%s\n", version)
			os.Exit(0)
		}
	}

	flag.Parse()

	logger := logger.InitializeLogger(*logLevel)
	logger.Info("garagepi starting", lager.Data{"version": version})<commit_msg>Fix typo in default redirectPort.<commit_after>package main

import (
	"flag"
	"fmt"
	"net/http"
	"os"

	"github.com/gorilla/mux"
	"github.com/gorilla/securecookie"
	"github.com/pivotal-golang/lager"
	"github.com/robdimsdale/garagepi/door"
	"github.com/robdimsdale/garagepi/filesystem"
	"github.com/robdimsdale/garagepi/gpio"
	"github.com/robdimsdale/garagepi/handler"
	"github.com/robdimsdale/garagepi/homepage"
	"github.com/robdimsdale/garagepi/light"
	"github.com/robdimsdale/garagepi/logger"
	"github.com/robdimsdale/garagepi/login"
	gpos "github.com/robdimsdale/garagepi/os"
	"github.com/robdimsdale/garagepi/static"
	"github.com/robdimsdale/garagepi/webcam"
	"github.com/tedsuo/ifrit"
	"github.com/tedsuo/ifrit/grouper"
)

var (
	// version is deliberately left uninitialized so it can be set at compile-time
	version string

	webcamHost = flag.String("webcamHost", "localhost", "Host of webcam image.")
	webcamPort = flag.Uint("webcamPort", 8080, "Port of webcam image.")

	gpioDoorPin  = flag.Uint("gpioDoorPin", 17, "Gpio pin of door.")
	gpioLightPin = flag.Uint("gpioLightPin", 2, "Gpio pin of light.")

	logLevel = flag.String("logLevel", string(logger.INFO), "log level: debug, info, error or fatal")

	enableHTTP  = flag.Bool("enableHTTP", true, "Enable HTTP traffic.")
	enableHTTPS = flag.Bool("enableHTTPS", false, "Enable HTTPS traffic.")
	forceHTTPS  = flag.Bool("forceHTTPS", false, "Redirect all HTTP traffic to HTTPS.")

	httpPort     = flag.Uint("httpPort", 13080, "Port on which to listen for HTTP (if enabled)")
	httpsPort    = flag.Uint("httpsPort", 13443, "Port on which to listen for HTTP (if enabled)")
	redirectPort = flag.Uint("redirectPort", 13443, "Port to which HTTP traffic is redirected (if forceHTTPS is enabled).")

	certFile = flag.String("certFile", "", "A PEM encoded certificate file.")
	keyFile  = flag.String("keyFile", "", "A PEM encoded private key file.")
	caFile   = flag.String("caFile", "", "A PEM encoded CA's certificate file.")

	username = flag.String("username", "", "Username for HTTP authentication.")
	password = flag.String("password", "", "Password for HTTP authentication.")

	dev = flag.Bool("dev", false, "Development mode; do not require username/password")
)

func main() {
	if version == "" {
		version = "dev"
	}

	if len(os.Args) > 1 {
		arg := os.Args[1]
		if arg == "version" || arg == "-v" || arg == "--version" {
			fmt.Printf("%s\n", version)
			os.Exit(0)
		}
	}

	flag.Parse()

	logger := logger.InitializeLogger(*logLevel)
	logger.Info("garagepi starting", lager.Data{"version": version})
{'fraction_non_alphanumeric': 0.15615203761755486, 'fraction_numerical': 0.009796238244514107, 'mean_word_length': 4.647123893805309, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6352957', 'n_tokens_mistral': 1863, 'n_tokens_neox': 1782, 'n_words': 419}