Skip to content

Commit

Permalink
update the last changes (#19)
Browse files Browse the repository at this point in the history
* fix(deps): update dependency org.junit.jupiter:junit-jupiter-api to v5.9.2 (#14)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* Add common modules to all the apps (#17)

* feat(taletum): authentication

add authentication domain

Signed-off-by: Yuniel Acosta Pérez <[email protected]>

* add cors

* feat(taletum): authentication

fix: pr action
Signed-off-by: Yuniel Acosta Pérez <[email protected]>

* feat(taletum): authentication

add basic oauth2 authentication

Signed-off-by: Yuniel Acosta Pérez <[email protected]>

* feat(taletum): authentication

fix: add basic oauth2 authentication 👮🏻‍♂️
Signed-off-by: Yuniel Acosta Pérez <[email protected]>

* feat(taletum): authentication

add security error handling

* feat(taletum): authentication

add security error handling

* feat(taletum): authentication

move auth logic to a new module

* feat(taletum): authentication

change to another authentication mechanism

* feat(event): add event module

added event module ✨

* feat(event): add event module

added coroutine-test, ulid and util module ✨

* feat(module): add event module

added coroutine-test, ulid and util module ✨

* feat(module): add event module

added data 📂module ✨

* feat(module): add event module

added data 📂module ✨

* feat(module): add event module

added data 📂modules ✨

* feat(module): add event module

added data modules with tests ✨

* feat(module): add event module

added data modules with tests ✨

* feat(module): add data module

added data module with support for neo4j 💽

---------

Signed-off-by: Yuniel Acosta Pérez <[email protected]>

---------

Signed-off-by: Yuniel Acosta Pérez <[email protected]>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
  • Loading branch information
yacosta738 and renovate[bot] authored Feb 22, 2023
1 parent 0db3eca commit f7688be
Show file tree
Hide file tree
Showing 322 changed files with 13,985 additions and 215 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/gradle-build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
pull_request:
branches:
- main
- develop
push:
branches:
- main
- develop

jobs:
build:
Expand Down
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/highlightedFiles.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/jpa-buddy.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/kotlinScripting.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
- repo: https://github.com/psf/black
rev: 22.10.0
hooks:
- id: black
32 changes: 29 additions & 3 deletions apps/talentum/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,44 @@ plugins {
val kotlinLoggingVersion: String by rootProject.extra

dependencies {
// L O C A L D E P E N D E N C I E S
implementation(project(":shared"))
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")

implementation("org.springframework.boot:spring-boot-starter-oauth2-resource-server")
implementation("org.springframework.boot:spring-boot-starter-security")
// S P R I N G
implementation("org.springframework.boot:spring-boot-starter-webflux")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation("org.springframework.boot:spring-boot-starter-validation")
annotationProcessor("org.springframework.boot:spring-boot-configuration-processor")

// 3 R D P A R T Y
implementation(libs.bundles.kotlinLogging)
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-reactor")

// D E V D E P E N D E N C I E S
developmentOnly("org.springframework.boot:spring-boot-devtools")

// T E S T D E P E N D E N C I E S
testImplementation("org.springframework.boot:spring-boot-starter-test")
testImplementation("org.springframework.security:spring-security-test")

val os =
org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurrentOperatingSystem()
val arch =
org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.getCurrentArchitecture()
if (os.isMacOsX && !arch.isAmd64) {
implementation("io.netty:netty-resolver-dns-native-macos") {
artifact {
classifier = "osx-aarch_64"
}
}
}

}

kotlin.sourceSets["main"].kotlin.srcDirs("src/main")
kotlin.sourceSets["test"].kotlin.srcDirs("src/test")

sourceSets["main"].resources.srcDirs("src/main/resources")
sourceSets["test"].resources.srcDirs("src/test/resources")
44 changes: 44 additions & 0 deletions apps/talentum/detekt-baseline.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version='1.0' encoding='UTF-8'?>
<SmellBaseline>
<CurrentIssues>
<ID>FinalNewline:com.astrum.talentum.controller.HelloController.kt:1</ID>
<ID>FinalNewline:com.astrum.talentum.unit.user.EmailTest.kt:1</ID>
<ID>FinalNewline:com.astrum.talentum.unit.user.FirstNameTest.kt:1</ID>
<ID>FinalNewline:com.astrum.talentum.unit.user.LastNameTest.kt:1</ID>
<ID>FinalNewline:com.astrum.talentum.unit.user.NameTest.kt:1</ID>
<ID>FinalNewline:com.astrum.talentum.user.Email.kt:1</ID>
<ID>FinalNewline:com.astrum.talentum.user.FirstName.kt:1</ID>
<ID>FinalNewline:com.astrum.talentum.user.LastName.kt:1</ID>
<ID>FinalNewline:com.astrum.talentum.user.Name.kt:1</ID>
<ID>FunctionOnlyReturningConstant:PingController.kt$PingController$@GetMapping fun ping()</ID>
<ID>ImplicitDefaultLocale:HelloController.kt$HelloController$String.format("Hello %s!",
auth.name)
</ID>
<ID>ImportOrdering:com.astrum.talentum.controller.HelloController.kt:3</ID>
<ID>Indentation:com.astrum.talentum.unit.user.EmailTest.kt:49</ID>
<ID>MagicNumber:ApplicationStartupTraces.kt$ApplicationStartupTraces$58</ID>
<ID>NewLineAtEndOfFile:Email.kt$com.astrum.talentum.user.Email.kt</ID>
<ID>NewLineAtEndOfFile:EmailTest.kt$com.astrum.talentum.unit.user.EmailTest.kt</ID>
<ID>NewLineAtEndOfFile:FirstName.kt$com.astrum.talentum.user.FirstName.kt</ID>
<ID>NewLineAtEndOfFile:FirstNameTest.kt$com.astrum.talentum.unit.user.FirstNameTest.kt</ID>
<ID>NewLineAtEndOfFile:HelloController.kt$com.astrum.talentum.controller.HelloController.kt</ID>
<ID>NewLineAtEndOfFile:LastName.kt$com.astrum.talentum.user.LastName.kt</ID>
<ID>NewLineAtEndOfFile:LastNameTest.kt$com.astrum.talentum.unit.user.LastNameTest.kt</ID>
<ID>NewLineAtEndOfFile:Name.kt$com.astrum.talentum.user.Name.kt</ID>
<ID>NewLineAtEndOfFile:NameTest.kt$com.astrum.talentum.unit.user.NameTest.kt</ID>
<ID>NoBlankLineBeforeRbrace:com.astrum.talentum.user.Email.kt:44</ID>
<ID>NoBlankLineBeforeRbrace:com.astrum.talentum.user.FirstName.kt:54</ID>
<ID>NoBlankLineBeforeRbrace:com.astrum.talentum.user.LastName.kt:21</ID>
<ID>NoBlankLineBeforeRbrace:com.astrum.talentum.user.LastName.kt:48</ID>
<ID>NoConsecutiveBlankLines:com.astrum.talentum.TalentumApplication.kt:8</ID>
<ID>NoConsecutiveBlankLines:com.astrum.talentum.controller.HelloController.kt:10</ID>
<ID>SpreadOperator:ApplicationStartupTraces.kt$ApplicationStartupTraces$(*profiles)</ID>
<ID>SwallowedException:ApplicationStartupTraces.kt$ApplicationStartupTraces$e:
UnknownHostException
</ID>
<ID>
TooManyFunctions:ApplicationStartupTraces.kt$ApplicationStartupTraces$ApplicationStartupTraces
</ID>
</CurrentIssues>
<ManuallySuppressedIssues/>
</SmellBaseline>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
package com.astrum.talentum

import com.astrum.common.domain.Generated
import mu.KotlinLogging
import org.springframework.core.env.Environment
import java.net.InetAddress
import java.net.UnknownHostException
import java.util.stream.Collectors
import java.util.stream.Stream

private val log = KotlinLogging.logger {}

object ApplicationStartupTraces {
private val SEPARATOR = "-".repeat(58)
private const val BREAK = "\n"
fun of(environment: Environment): String {
return ApplicationStartupTracesBuilder()
.append(BREAK)
.appendSeparator()
.append(applicationRunningTrace(environment))
.append(localUrl(environment))
.append(externalUrl(environment))
.append(profilesTrace(environment))
.appendSeparator()
.append(configServer(environment))
.build()
}

private fun applicationRunningTrace(environment: Environment): String {
val applicationName: String = environment.getProperty("spring.application.name", "")
return if (applicationName.isBlank()) {
"Application is running!"
} else StringBuilder().append("Application '").append(applicationName)
.append("' is running!").toString()
}

private fun localUrl(environment: Environment): String {
return url("Local", "localhost", environment)
}

private fun externalUrl(environment: Environment): String {
return url("External", hostAddress(), environment)
}

private fun url(type: String, host: String, environment: Environment): String {
return if (notWebEnvironment(environment)) {
"\uD83D\uDE80 $type: \t$host"
} else StringBuilder()
.append(type)
.append(": \t")
.append(protocol(environment))
.append("://")
.append(host)
.append(":")
.append(port(environment))
.append(contextPath(environment))
.toString()
}

private fun notWebEnvironment(environment: Environment): Boolean {
return environment.getProperty("server.port")?.isBlank() ?: true
}

private fun protocol(environment: Environment): String {
return if (noKeyStore(environment)) {
"http"
} else "https"
}

private fun noKeyStore(environment: Environment): Boolean {
return environment.getProperty("server.ssl.key-store")?.isBlank() ?: true
}

private fun port(environment: Environment): String {
return environment.getProperty("server.port", "8080")
}

private fun profilesTrace(environment: Environment): String {
val profiles: Array<String> = environment.activeProfiles
return if (profiles.isEmpty()) {
" No active profile set, falling back to default profiles: default"
} else StringBuilder().append("Profile(s): \t")
.append(Stream.of(*profiles).collect(Collectors.joining(", "))).toString()
}

@Generated(reason = "Hard to test implement detail error management")
private fun hostAddress(): String {
try {
return InetAddress.getLocalHost().hostAddress
} catch (e: UnknownHostException) {
log.warn("The host name could not be determined, using `localhost` as fallback")
}
return "localhost"
}

private fun contextPath(environment: Environment): String {
val contextPath: String = environment.getProperty("server.servlet.context-path", "/")
return contextPath.takeIf { it.isNotBlank() } ?: "/"
}

private fun configServer(environment: Environment): String {
val configServer: String = environment.getProperty("configserver.status", "")
return if (configServer.isBlank()) {
"Config Server: \tNot found or not setup for this application"
} else StringBuilder().append("Config Server: ").append(configServer).append(BREAK).append(
SEPARATOR
).append(BREAK).toString()
}

private class ApplicationStartupTracesBuilder {
private val trace = StringBuilder()
fun appendSeparator(): ApplicationStartupTracesBuilder {
trace.append(SEPARATOR).append(BREAK)
return this
}

fun append(line: String): ApplicationStartupTracesBuilder {
trace.append(SPACER).append(line).append(BREAK)
return this
}

fun build(): String {
return trace.toString()
}

companion object {
private const val SPACER = " "
}
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
package com.astrum.talentum

import org.springframework.boot.WebApplicationType
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import org.springframework.boot.builder.SpringApplicationBuilder
import org.springframework.boot.context.properties.EnableConfigurationProperties

@SpringBootApplication

@SpringBootApplication(scanBasePackages = ["com.astrum.*"])
@EnableConfigurationProperties
class TalentumApplication

fun main(vararg args: String) {
runApplication<TalentumApplication>(*args)
SpringApplicationBuilder(TalentumApplication::class.java)
.web(WebApplicationType.REACTIVE)
.run(*args)
}
Loading

0 comments on commit f7688be

Please sign in to comment.