<commit_before>package com.felipecosta.microservice

import com.felipecosta.microservice.app.core.data.RedisMoviesRepository
import com.felipecosta.microservice.app.core.domain.MoviesRepository
import com.felipecosta.microservice.app.helloworld.frontcontroller.HelloFrontCommand
import com.felipecosta.microservice.app.json.frontcontroller.JsonFrontCommand
import com.felipecosta.microservice.app.movies.frontcontroller.*
import com.felipecosta.microservice.app.notes.frontcontroller.NotesFrontCommand
import com.felipecosta.microservice.server.*
import com.felipecosta.microservice.server.renderer.impl.PebbleRenderer
import com.github.salomonbrys.kodein.*
import com.mitchellbosecke.pebble.PebbleEngine

fun main(args: Array<String>) {
    val pebbleEngine = PebbleEngine.Builder().build()

    val kodein = Kodein {

        constant("redisUri") with (if (System.getenv("REDIS_URI") != null) System.getenv("REDIS_URI") else "redis:6379")

        bind<MoviesRepository>() with singleton { RedisMoviesRepository(instance("redisUri")) }

        bind<ListMoviesFrontCommand>() with provider { ListMoviesFrontCommand(instance()) }

        bind<GetMovieFrontCommand>() with provider { GetMovieFrontCommand(instance()) }

        bind<CreateMovieFrontCommand>() with provider { CreateMovieFrontCommand(instance()) }

        bind<UpdateMovieFrontCommand>() with provider { UpdateMovieFrontCommand(instance()) }

        bind<DeleteMovieFrontCommand>() with provider { DeleteMovieFrontCommand(instance()) }
    }

    server {

        handler { SparkServerHandler() }

        +(map get "/" to ::HelloFrontCommand)
        +(map get "/json" to ::JsonFrontCommand)
        +(map get "/notes" to ::NotesFrontCommand with PebbleRenderer(pebbleEngine))
<commit_msg>Use system REDIS_URL instead of REDIS_URI<commit_after>package com.felipecosta.microservice

import com.felipecosta.microservice.app.core.data.RedisMoviesRepository
import com.felipecosta.microservice.app.core.domain.MoviesRepository
import com.felipecosta.microservice.app.helloworld.frontcontroller.HelloFrontCommand
import com.felipecosta.microservice.app.json.frontcontroller.JsonFrontCommand
import com.felipecosta.microservice.app.movies.frontcontroller.*
import com.felipecosta.microservice.app.notes.frontcontroller.NotesFrontCommand
import com.felipecosta.microservice.server.*
import com.felipecosta.microservice.server.renderer.impl.PebbleRenderer
import com.github.salomonbrys.kodein.*
import com.mitchellbosecke.pebble.PebbleEngine

fun main(args: Array<String>) {
    val pebbleEngine = PebbleEngine.Builder().build()

    val kodein = Kodein {

        constant("redisUri") with (if (System.getenv("REDIS_URL") != null) System.getenv("REDIS_URL") else "redis:6379")

        bind<MoviesRepository>() with singleton { RedisMoviesRepository(instance("redisUri")) }

        bind<ListMoviesFrontCommand>() with provider { ListMoviesFrontCommand(instance()) }

        bind<GetMovieFrontCommand>() with provider { GetMovieFrontCommand(instance()) }

        bind<CreateMovieFrontCommand>() with provider { CreateMovieFrontCommand(instance()) }

        bind<UpdateMovieFrontCommand>() with provider { UpdateMovieFrontCommand(instance()) }

        bind<DeleteMovieFrontCommand>() with provider { DeleteMovieFrontCommand(instance()) }
    }

    server {

        handler { SparkServerHandler() }

        +(map get "/" to ::HelloFrontCommand)
        +(map get "/json" to ::JsonFrontCommand)
        +(map get "/notes" to ::NotesFrontCommand with PebbleRenderer(pebbleEngine))

{'fraction_non_alphanumeric': 0.10879368658399098, 'fraction_numerical': 0.002254791431792559, 'mean_word_length': 5.204545454545454, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '4938410', 'n_tokens_mistral': 1094, 'n_tokens_neox': 1007, 'n_words': 169}