<commit_before>package main

import (
	"./api"
	"github.com/gorilla/mux"
	"log"
	"net/http"
)

var config *Config

func redirectHandler(w http.ResponseWriter, r *http.Request) {
	http.Redirect(w, r, "https://"+config.Website.Url+config.Website.HttpsPort+r.RequestURI, http.StatusTemporaryRedirect)
}

func main() {
	config := NewConfig()
	err := config.ReadFile("config.gcfg")
	if err != nil {
		log.Fatal(err)
	}

	r := mux.NewRouter()
	apiHandler, err := api.MakeHandler()
	if err != nil {
		log.Fatal(err)
	}
	r.PathPrefix("/api/").Handler(apiHandler)
	r.PathPrefix("/").Handler(http.FileServer(http.Dir("../app/")))
	http.Handle("/", r)
	go func() {
		log.Printf("Serving HTTP on %v\n", config.Website.HttpPort)
		err := http.ListenAndServe(config.Website.HttpPort, http.HandlerFunc(redirectHandler))
		if err != nil {
			log.Fatal(err)
		}
	}()
	log.Printf("Serving HTTPS on %v\n", config.Website.HttpsPort)
	err = http.ListenAndServeTLS(config.Website.HttpsPort, "cert.pem", "key.pem", nil)
	if err != nil {
		log.Fatal(err)
	}
}<commit_msg>Fix config creation<commit_after>package main

import (
	"./api"
	"fmt"
	"github.com/gorilla/mux"
	"log"
	"net/http"
)

var config *Config

func redirectHandler(w http.ResponseWriter, r *http.Request) {
	url := fmt.Sprintf("https://%s%s%s", config.Website.Url, config.Website.HttpsPort, r.RequestURI)
	http.Redirect(w, r, url, http.StatusTemporaryRedirect)
}

func main() {
	config = NewConfig()
	err := config.ReadFile("config.gcfg")
	if err != nil {
		log.Fatal(err)
	}

	r := mux.NewRouter()
	apiHandler, err := api.MakeHandler()
	if err != nil {
		log.Fatal(err)
	}
	r.PathPrefix("/api/").Handler(apiHandler)
	r.PathPrefix("/").Handler(http.FileServer(http.Dir("../app/")))
	http.Handle("/", r)
	go func() {
		log.Printf("Serving HTTP on %s\n", config.Website.HttpPort)
		err := http.ListenAndServe(config.Website.HttpPort, http.HandlerFunc(redirectHandler))
		if err != nil {
			log.Fatal(err)
		}
	}()
	log.Printf("Serving HTTPS on %s\n", config.Website.HttpsPort)
	err = http.ListenAndServeTLS(config.Website.HttpsPort, "cert.pem", "key.pem", nil)
	if err != nil {
		log.Fatal(err)
	}
}
{'fraction_non_alphanumeric': 0.18457943925233644, 'fraction_numerical': 0.0, 'mean_word_length': 4.286419753086419, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2918318', 'n_tokens_mistral': 869, 'n_tokens_neox': 829, 'n_words': 148}