<commit_before>package main

import (
	"os"
	"net/http"
	"github.com/gorilla/mux"
	"github.com/jawher/mow.cli"
	fthealth "github.com/Financial-Times/go-fthealth/v1a"
	log "github.com/Sirupsen/logrus"
	"time"
	"github.com/rcrowley/go-metrics"
	"github.com/Financial-Times/http-handlers-go"
)

const serviceName = "content-preview"
const serviceDescription = "A RESTful API for retrieving and transforming content to preview data"


var timeout = time.Duration(5 * time.Second)
var client = &http.Client{Timeout: timeout}

func main() {
	log.SetLevel(log.InfoLevel)
	log.Infof("%s service started with args %s", serviceName, os.Args)

	app := cli.App(serviceName, serviceDescription)
	appPort := app.StringOpt("app-port", "8084", "Default port for app")
	mapiAuth := app.StringOpt("mapi-auth", "default", "Basic auth for MAPI")
	mapiUri := app.StringOpt("mapi-uri", "http://methode-api-uk-p.svc.ft.com", "Host and port for MAPI")
	matHostHeader := app.StringOpt("mat-host-header", "methode-article-transformer", "Hostheader for MAT")
	matUri := app.StringOpt("mat-uri", "http://ftapp05951-lvpr-uk-int:8080", "Host and port for MAT")

	app.Action = func() {
		r := mux.NewRouter()
		handler := Handlers{*mapiAuth, *matHostHeader, *mapiUri, *matUri}
		r.HandleFunc("/content-preview/{uuid}", handler.contentPreviewHandler)
		r.HandleFunc("/build-info", handler.buildInfoHandler)
		r.HandleFunc("/__health", fthealth.Handler(serviceName, serviceDescription, handler.mapiCheck(), handler.matCheck()))
		r.HandleFunc("/__ping", pingHandler)

		log.WithFields(log.Fields{
			"mapi-uri" : *mapiUri,
			"mat-uri"  : *matUri,
			"mapi-auth" : *mapiAuth,
			"mat-host-header" : *matHostHeader,
		}).Infof("%s service started on localhost:%s with configuration", serviceName, *appPort)

		err := http.ListenAndServe( ":"+*appPort,
			httphandlers.HTTPMetricsHandler(metrics.DefaultRegistry,
				httphandlers.TransactionAwareRequestLoggingHandler(log.StandardLogger(), r)))

		if err != nil {
			log.Fatalf("Unable to start server: %v", err)
		}

	}

	app.Run(os.Args)

}
<commit_msg>removed mapi key from logging<commit_after>package main

import (
	"os"
	"net/http"
	"github.com/gorilla/mux"
	"github.com/jawher/mow.cli"
	fthealth "github.com/Financial-Times/go-fthealth/v1a"
	log "github.com/Sirupsen/logrus"
	"time"
	"github.com/rcrowley/go-metrics"
	"github.com/Financial-Times/http-handlers-go"
)

const serviceName = "content-preview"
const serviceDescription = "A RESTful API for retrieving and transforming content to preview data"


var timeout = time.Duration(5 * time.Second)
var client = &http.Client{Timeout: timeout}

func main() {
	log.SetLevel(log.InfoLevel)
	log.Infof("%s service started with args %s", serviceName, os.Args)

	app := cli.App(serviceName, serviceDescription)
	appPort := app.StringOpt("app-port", "8084", "Default port for app")
	mapiAuth := app.StringOpt("mapi-auth", "default", "Basic auth for MAPI")
	mapiUri := app.StringOpt("mapi-uri", "http://methode-api-uk-p.svc.ft.<EMAIL>", "Host and port for MAPI")
	matHostHeader := app.StringOpt("mat-host-header", "methode-article-transformer", "Hostheader for MAT")
	matUri := app.StringOpt("mat-uri", "http://ftapp05951-lvpr-uk-int:8080", "Host and port for MAT")

	app.Action = func() {
		r := mux.NewRouter()
		handler := Handlers{*mapiAuth, *matHostHeader, *mapiUri, *matUri}
		r.HandleFunc("/content-preview/{uuid}", handler.contentPreviewHandler)
		r.HandleFunc("/build-info", handler.buildInfoHandler)
		r.HandleFunc("/__health", fthealth.Handler(serviceName, serviceDescription, handler.mapiCheck(), handler.matCheck()))
		r.HandleFunc("/__ping", pingHandler)

		log.WithFields(log.Fields{
			"mapi-uri" : *mapiUri,
			"mat-uri"  : *matUri,
		}).Infof("%s service started on localhost:%s with configuration", serviceName, *appPort)

		err := http.ListenAndServe( ":"+*appPort,
			httphandlers.HTTPMetricsHandler(metrics.DefaultRegistry,
				httphandlers.TransactionAwareRequestLoggingHandler(log.StandardLogger(), r)))

		if err != nil {
			log.Fatalf("Unable to start server: %v", err)
		}

	}

	app.Run(os.Args)

}

{'fraction_non_alphanumeric': 0.1595406792084046, 'fraction_numerical': 0.007329587099926704, 'mean_word_length': 5.038348082595871, 'pattern_counts': {'":': 2, '<': 4, '<?xml version=': 0, '>': 4, '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': '1278657', 'n_tokens_mistral': 1526, 'n_tokens_neox': 1432, 'n_words': 284}