<commit_before>package handlers

import (
	"io"
	"log"
	"net/http"
	"time"

	"github.com/zenazn/goji/web"
)

const STATIC_URL string = "http://redskull.iamtherealbill.com/static/"
const STATIC_ROOT string = "html/static/"

// Static serves static content such as images, JS and CSS files
func Static(c web.C, w http.ResponseWriter, req *http.Request) {
	//log.Printf("STATIC_URL: %s, %d", STATIC_URL, len(STATIC_URL))
	//log.Printf("PATH: %s, %d", req.URL.Path, len(STATIC_URL))
	static_file := req.URL.Path[7:]
	if len(static_file) != 0 {
		f, err := http.Dir(STATIC_ROOT).Open(static_file)
		if err == nil {
			content := io.ReadSeeker(f)
			http.ServeContent(w, req, static_file, time.Now(), content)
			return
		}
		log.Print(err)
	}
	http.NotFound(w, req)
}<commit_msg>fixing STATIC_ROOT to use envconfig for base directory<commit_after>package handlers

import (
	"io"
	"log"
	"net/http"
	"time"

	"github.com/zenazn/goji/web"
)

const STATIC_URL string = "http://redskull.iamtherealbill.com/static/"
const STATIC_ROOT string = "html/static/"

// Static serves static content such as images, JS and CSS files
func Static(c web.C, w http.ResponseWriter, req *http.Request) {
	//log.Printf("STATIC_URL: %s, %d", STATIC_URL, len(STATIC_URL))
	//log.Printf("PATH: %s, %d", req.URL.Path, len(STATIC_URL))
	static_file := req.URL.Path[7:]
	root := TemplateBase + STATIC_ROOT
	if len(static_file) != 0 {
		f, err := http.Dir(root).Open(static_file)
		if err == nil {
			content := io.ReadSeeker(f)
			http.ServeContent(w, req, static_file, time.Now(), content)
			return
		}
		log.Print(err)
	}
	http.NotFound(w, req)
}
{'fraction_non_alphanumeric': 0.16007416563658838, 'fraction_numerical': 0.002472187886279357, 'mean_word_length': 4.22258064516129, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '6372890', 'n_tokens_mistral': 665, 'n_tokens_neox': 624, 'n_words': 142}