-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
* 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
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,9 +4,11 @@ on: | |
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
|
||
jobs: | ||
build: | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 |
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) | ||
} |