<commit_before>package com.hoserdude.toboot.config;

import com.mongodb.MongoURI;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.data.mongodb.MongoDbFactory;
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;

import java.net.URI;
import java.net.URISyntaxException;

/**
 * This is only activated in the heroku environment, otherwise Spring Boot
 * automaticially sets you up for local config
 */
@Profile("heroku")
@Configuration
public class HerokuDatabaseConfig {
    @Bean
    public MongoDbFactory mongoDbFactory() throws Exception {
        MongoURI mongoURI = new MongoURI(System.getenv("MONGOHQ_URL"));
        return new SimpleMongoDbFactory(mongoURI);
    }

    @Bean
    public URI dbUrl() throws URISyntaxException {
        URI dbUri = new URI(System.getenv("DATABASE_URL"));
        return dbUri;
    }
}<commit_msg>trying again<commit_after>package com.hoserdude.toboot.config;

import com.mongodb.MongoURI;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.data.mongodb.MongoDbFactory;
import org.springframework.data.mongodb.core.SimpleMongoDbFactory;

import java.net.URI;
import java.net.URISyntaxException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * This is only activated in the heroku environment, otherwise Spring Boot
 * automaticially sets you up for local config
 */
@Profile("heroku")
@Configuration
public class HerokuDatabaseConfig {
    @Bean
    public MongoDbFactory mongoDbFactory() throws Exception {
        MongoURI mongoURI = new MongoURI(System.getenv("MONGOHQ_URL"));
        return new SimpleMongoDbFactory(mongoURI);
    }

    @Bean
    public Connection getConnection() throws URISyntaxException, SQLException {
        URI dbUri = new URI(System.getenv("DATABASE_URL"));

        String username = dbUri.getUserInfo().split(":")[0];
        String password = dbUri.getUserInfo().split(":")[1];
        String dbUrl = "jdbc:postgresql://" + dbUri.getHost() + dbUri.getPath();

        return DriverManager.getConnection(dbUrl, username, password);
    }
}
{'fraction_non_alphanumeric': 0.10029623360135421, 'fraction_numerical': 0.0008463817181548879, 'mean_word_length': 4.6826923076923075, 'pattern_counts': {'":': 2, '<': 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': '4627573', 'n_tokens_mistral': 691, 'n_tokens_neox': 672, 'n_words': 153}