<commit_before>import os
import subprocess

import configmaster

cfg = configmaster.YAMLConfigFile.YAMLConfigFile("config.yml")

cfg.apply_defaults(configmaster.YAMLConfigFile.YAMLConfigFile("config.default.yml"))

API_VERSION = 1
SKIER_VERSION = 1.5

redis_host = os.environ.get("REDIS_PORT_6379_TCP_ADDR", cfg.config.redis.host)

local_ip = subprocess.check_output(['/bin/bash', '-c', "echo -n $(ip route show | awk '/default/ {print $3}')"]).decode()

host = os.environ.get("POSTGRES_PORT_5432_TCP_ADDR", cfg.config.db.host)

if host == "docker0":
    host = local_ip


sqlalchemy_uri = "postgresql://{user}:{password}@{host}:{port}/{database}".format(
    user = cfg.config.db.user,
    password = <PASSWORD>,
    host = host,
    port = os.environ.get("POSTGRES_PORT_5432_TCP_PORT") or cfg.config.db.port, # This doesn't make any sense.
    database = cfg.config.db.database
)
<commit_msg>ensure we can configure skier from an env var<commit_after>import os
import subprocess

import configmaster

skier_config_path = os.environ.get("SKIER_CONFIG_PATH", "config.yml")
cfg = configmaster.YAMLConfigFile.YAMLConfigFile(skier_config_path)
cfg.apply_defaults(configmaster.YAMLConfigFile.YAMLConfigFile("config.default.yml"))

API_VERSION = 1
SKIER_VERSION = 1.5

redis_host = os.environ.get("REDIS_PORT_6379_TCP_ADDR", cfg.config.redis.host)

local_ip = subprocess.check_output(['/bin/bash', '-c', "echo -n $(ip route show | awk '/default/ {print $3}')"]).decode()

host = os.environ.get("POSTGRES_PORT_5432_TCP_ADDR", cfg.config.db.host)

if host == "docker0":
    host = local_ip


sqlalchemy_uri = "postgresql://{user}:{password}@{host}:{port}/{database}".format(
    user = cfg.config.db.user,
    password = cfg.config.db.password,
    host = host,
    port = os.environ.get("POSTGRES_PORT_5432_TCP_PORT") or cfg.config.db.port, # This doesn't make any sense.
    database = cfg.config.db.database
)

{'fraction_non_alphanumeric': 0.1484784889821616, 'fraction_numerical': 0.017838405036726127, 'mean_word_length': 5.053968253968254, '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': '6967732', 'n_tokens_mistral': 721, 'n_tokens_neox': 686, 'n_words': 121}