This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<configuration> | |
<appender name="STDERR" class="ch.qos.logback.core.ConsoleAppender"> | |
<target>System.err</target> | |
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> | |
<level>WARN</level> | |
</filter> | |
<encoder> | |
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern> | |
</encoder> | |
</appender> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: my-app-chart | |
version: 0.0.1 # Use Jenkinsfile for versioning | |
description: My App | |
keywords: | |
- app | |
maintainers: | |
- name: Jeroen Rosenberg | |
email: jeroen.rosenberg@gmail.com | |
engine: gotpl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun <T> List<T>.permutations(): List<List<T>> = | |
when { | |
size < 2 -> listOf(this) | |
size == 2 -> listOf(listOf(first(), last()), listOf(last(), first())) | |
else -> flatMap { element -> | |
(this - element).permutations().map { listOf(element) + it } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in Domain Module | |
data class ExchangeRateDto(val rate: BigDecimal, val currency: Currency) | |
interface ExchangeRateApiClientPort { | |
fun getRate(source: Currency, target: Currency): ExchangeRateDto | |
} | |
// in Infrastructure Module | |
class ExchangeRateApiClientAdapter : ExchangeRateApiClientPort { | |
override fun getRate(source: Currency, target: Currency): ExchangeRateDto { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
labels: | |
app: prometheus | |
name: prometheus | |
data: | |
prometheus.yml: | | |
global: | |
evaluation_interval: 1m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source 'https://rubygems.org' | |
gem 'rails', '3.2.3' | |
# Gems used only for assets and not required | |
# in production environments by default. | |
group :assets do | |
gem 'sass-rails', '~> 3.2.3' | |
gem 'coffee-rails', '~> 3.2.1' | |
# See https://github.com/sstephenson/execjs#readme for more supported runtimes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :deploy do | |
task :restart do | |
stop | |
sleep 1 | |
start | |
end | |
task :start do | |
targets = find_servers_for_task(current_task) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Service | |
class DepositService( | |
val userRepo: UserRepository, | |
val userAccountRepo: UserAccountRepository, | |
val exchangeApiClient: ExchangeApiClient, | |
val eventBus: EventBus | |
) { | |
@Transactional | |
fun deposit(userId: String, amount: BigDecimal, currency: String){ | |
require(amount > BigDecimal.ZERO) { “Amount must be larger than 0” } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open class DepositOrchestrationService( | |
private val depositService: DepositService, | |
private val userAccountRepositoryPort: UserAccountRepositoryPort, | |
private val userAccountEventPublisherPort: UserAccountEventPublisherPort | |
) { | |
@Transactional | |
open suspend fun deposit(request: DepositRequestDto): DepositResponseDto? = | |
userAccountRepositoryPort.findById(request.userId)?.let { userAccount -> | |
val oldBalance = userAccount.balance | |
val updated = depositService.deposit(userAccount, request.amount) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DepositService(private val exchangeRateApiClient: ExchangeRateApiClientPort) { | |
suspend fun deposit(userAccount: UserAccountDto, amount: Money): UserAccountDto { | |
require(amount.largerThanZero) { "Amount must be larger than 0" } | |
val rateToUsd = if (amount.currency != Currency.USD) { | |
exchangeRateApiClient.getRate(amount.currency, Currency.USD) | |
} else { | |
ExchangeRateDto(BigDecimal.ONE, Currency.USD) | |
} | |
val rateToPref = if (userAccount.balance.currency != Currency.USD) { | |
exchangeRateApiClient.getRate(Currency.USD, userAccount.balance.currency) |
NewerOlder