<commit_before>package com.github.k0kubun.github_ranking.config;

import com.mysql.cj.jdbc.MysqlDataSource;

import java.util.Collections;
import java.util.Map;

import javax.sql.DataSource;

public class DatabaseConfig
{
    private static final String DEFAULT_HOST = "127.0.0.1";
    private static final Integer DEFAULT_PORT = 3306;
    private static final String DEFAULT_USER = "root";
    private static final String DEFAULT_PASSWORD = "";
    private static final String DEFAULT_DATABASE = "github_ranking";

    private final Map<String, String> env;

    public DatabaseConfig(Map<String, String> env)
    {
        this.env = env;
    }

    public DataSource getDataSource()
    {
        MysqlDataSource mysqlDataSource = new MysqlDataSource();
        mysqlDataSource.setUrl(getUrl());
        mysqlDataSource.setUser(getUser());
        mysqlDataSource.setPassword(getPassword());
        mysqlDataSource.setConnectionInitSqls(Collections.singleton("SET NAMES utf8mb4"));
        return mysqlDataSource;
    }

    public String getUrl()
    {
        return String.format("jdbc:mysql://%s:%d/%s",
                getHost(),
                getPort(),
                getDatabaseName());
    }

    public String getUser()
    {
        return env.getOrDefault("DATABASE_USER", DEFAULT_USER);
    }

    public String getPassword()
    {
        return env.getOrDefault("DATABASE_PASSWORD", DEFAULT_PASSWORD);
    }
<commit_msg>Revert "Resurrect connection init SQL"<commit_after>package com.github.k0kubun.github_ranking.config;

import com.mysql.cj.jdbc.MysqlDataSource;

import java.util.Map;

import javax.sql.DataSource;

public class DatabaseConfig
{
    private static final String DEFAULT_HOST = "127.0.0.1";
    private static final Integer DEFAULT_PORT = 3306;
    private static final String DEFAULT_USER = "root";
    private static final String DEFAULT_PASSWORD = "";
    private static final String DEFAULT_DATABASE = "github_ranking";

    private final Map<String, String> env;

    public DatabaseConfig(Map<String, String> env)
    {
        this.env = env;
    }

    public DataSource getDataSource()
    {
        MysqlDataSource mysqlDataSource = new MysqlDataSource();
        mysqlDataSource.setUrl(getUrl());
        mysqlDataSource.setUser(getUser());
        mysqlDataSource.setPassword(<PASSWORD>());
        return mysqlDataSource;
    }

    public String getUrl()
    {
        return String.format("jdbc:mysql://%s:%d/%s",
                getHost(),
                getPort(),
                getDatabaseName());
    }

    public String getUser()
    {
        return env.getOrDefault("DATABASE_USER", DEFAULT_USER);
    }

    public String getPassword()
    {
        return env.getOrDefault("DATABASE_PASSWORD", DEFAULT_PASSWORD);
    }

{'fraction_non_alphanumeric': 0.1004664513814137, 'fraction_numerical': 0.008611410118406888, 'mean_word_length': 2.960227272727273, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '7324463', 'n_tokens_mistral': 810, 'n_tokens_neox': 768, 'n_words': 175}