<commit_before>// Copyright (c) 2014 Pagoda Box Inc.
//
// This Source Code Form is subject to the terms of the Mozilla Public License,
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.

//
package config

import (
	"errors"
	"io/ioutil"
	"net"
	"net/http"
	"strings"

	"github.com/jcelliott/lumber"

	"github.com/nanobox-io/nanobox-logtap"
	"github.com/nanopack/mist/core"
)

//
var (
	app         string
	LogtapHost  string
	Ports       map[string]string
	IP          string
	MountFolder string
	DockerMount string

	Log        lumber.Logger
	Logtap     *logtap.Logtap
	Mist       *mist.Mist
	LogHandler http.HandlerFunc
)

//
func init() {
	MountFolder = "/vagrant/"
	DockerMount = "/mnt/"
	// create an error object
	var err error

	Log = lumber.NewConsoleLogger(lumber.INFO)

	//
	Ports = map[string]string{
		"api":    ":1757",
		"logtap": ":514",
		"mist":   ":1445",
		"router": "60000",
	}

	IP, err = externalIP()
	if err != nil {
		Log.Error("error: %s\n", err.Error())
	}

	LogtapHost = IP

	Mist = mist.New()
	Logtap = logtap.New(Log)
}

//<commit_msg>Allow the log level to be configured through a ENVVAR<commit_after>// Copyright (c) 2014 Pagoda Box Inc.
//
// This Source Code Form is subject to the terms of the Mozilla Public License,
// v. 2.0. If a copy of the MPL was not distributed with this file, You can
// obtain one at http://mozilla.org/MPL/2.0/.

//
package config

import (
	"errors"
	"io/ioutil"
	"net"
	"net/http"
	"strings"

	"github.com/jcelliott/lumber"

	"github.com/nanobox-io/nanobox-logtap"
	"github.com/nanopack/mist/core"
)

//
var (
	app         string
	LogtapHost  string
	Ports       map[string]string
	IP          string
	MountFolder string
	DockerMount string

	Log        lumber.Logger
	Logtap     *logtap.Logtap
	Mist       *mist.Mist
	LogHandler http.HandlerFunc
)

//
func init() {
	MountFolder = "/vagrant/"
	DockerMount = "/mnt/"
	// create an error object
	var err error
	levelEnv := os.Getenv("NANOBOX_LOGLEVEL")
	if levelEnv == "" {
		levelEnv = "INFO"
	}
	Log = lumber.NewConsoleLogger(lumber.LvlInt(levelEnv))

	//
	Ports = map[string]string{
		"api":    ":1757",
		"logtap": ":514",
		"mist":   ":1445",
		"router": "60000",
	}

	IP, err = externalIP()
	if err != nil {
		Log.Error("error: %s\n", err.Error())
	}

	LogtapHost = IP

	Mist = mist.New()
	Logtap = logtap.New(Log)
}

//
{'fraction_non_alphanumeric': 0.14344941956882257, 'fraction_numerical': 0.01990049751243781, 'mean_word_length': 2.8, 'pattern_counts': {'":': 14, '<': 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': '1406552', 'n_tokens_mistral': 1010, 'n_tokens_neox': 916, 'n_words': 241}