-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #182 from boudicca-events/abl/split-publisher
split publisher
- Loading branch information
Showing
18 changed files
with
182 additions
and
16 deletions.
There are no files selected for viewing
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
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
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
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
13 changes: 13 additions & 0 deletions
13
...sher-event-html/src/main/kotlin/base/boudicca/publisher/event/html/extension/Extension.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package base.boudicca.publisher.event.html.extension | ||
|
||
interface Extension { | ||
fun getHeaders(): List<HeaderExtension> { | ||
return emptyList() | ||
} | ||
} | ||
|
||
data class HeaderExtension( | ||
val text: String, | ||
val url: String, | ||
val target: String = "_self", | ||
) |
39 changes: 39 additions & 0 deletions
39
.../main/kotlin/base/boudicca/publisher/event/html/extension/HeaderExtensionValueResolver.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package base.boudicca.publisher.event.html.extension | ||
|
||
import com.github.jknack.handlebars.ValueResolver | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.stereotype.Component | ||
|
||
@Component | ||
class HeaderExtensionValueResolver @Autowired constructor(extensions: List<Extension>) : ValueResolver { | ||
|
||
private val headers: List<Map<String, String>> = getAllExtensionHeaders(extensions) | ||
|
||
override fun resolve(context: Any?, name: String?): Any { | ||
return if (name == "extensionHeaders") { | ||
headers | ||
} else { | ||
ValueResolver.UNRESOLVED | ||
} | ||
} | ||
|
||
override fun resolve(context: Any?): Any { | ||
return ValueResolver.UNRESOLVED | ||
} | ||
|
||
override fun propertySet(context: Any?): MutableSet<MutableMap.MutableEntry<String, List<Map<String, String>>>> { | ||
return mutableSetOf(mutableMapOf("extensionHeaders" to headers).entries.first()) | ||
} | ||
|
||
private fun getAllExtensionHeaders(extensions: List<Extension>): List<Map<String, String>> { | ||
return extensions.flatMap { extension -> extension.getHeaders() } | ||
.map { header -> | ||
mapOf( | ||
"text" to header.text, | ||
"url" to header.url, | ||
"target" to header.target, | ||
) | ||
} | ||
} | ||
|
||
} |
6 changes: 3 additions & 3 deletions
6
boudicca.base/publisher-event-html/src/main/resources/templates/layout/header_links.hbs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
<div class="header-links"> | ||
<a href="/" target="_self">Events</a> | ||
<a href="/about" target="_self">Über uns</a> | ||
<a href="/impressum" target="_self">Impressum</a> | ||
<a href="https://github.com/boudicca-events/boudicca.events" target="_blank">GitHub</a> | ||
{{#each extensionHeaders as |extensionHeader|}} | ||
<a href="{{extensionHeader.url}}" target="{{extensionHeader.target}}">{{extensionHeader.text}}</a> | ||
{{/each}} | ||
</div> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
src | ||
!build/libs/* |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
HELP.md | ||
.gradle | ||
build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import org.springframework.boot.gradle.tasks.bundling.BootJar | ||
|
||
plugins { | ||
id("org.springframework.boot") | ||
id("io.spring.dependency-management") | ||
kotlin("jvm") | ||
kotlin("plugin.spring") | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
kotlin { | ||
jvmToolchain(17) | ||
compilerOptions { | ||
javaParameters = true | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(project(":boudicca.base:publisher-event-html")) | ||
testImplementation("org.springframework.boot:spring-boot-starter-test") | ||
} | ||
|
||
tasks.named<BootJar>("bootJar") { | ||
mainClass.set("events.boudicca.publisherhtml.PublisherHtmlApplicationKt") | ||
} | ||
|
||
tasks.withType<Test> { | ||
useJUnitPlatform() | ||
} | ||
|
||
task<Exec>("imageBuild") { | ||
inputs.file("src/main/docker/Dockerfile") | ||
inputs.files(tasks.named("bootJar")) | ||
dependsOn(tasks.named("assemble")) | ||
commandLine("docker", "build", "-t", "localhost/boudicca-html", "-f", "src/main/docker/Dockerfile", ".") | ||
} |
7 changes: 7 additions & 0 deletions
7
boudicca.events/publisher-event-html/src/main/docker/Dockerfile
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
FROM docker.io/eclipse-temurin:17-alpine | ||
|
||
EXPOSE 8080 | ||
|
||
COPY build/libs/publisher-event-html.jar /opt/boudicca-html/ | ||
WORKDIR /opt/boudicca-html/ | ||
CMD ["java", "-Dserver.port=8080", "-jar", "publisher-event-html.jar"] |
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions
14
.../src/test/kotlin/base/boudicca/publisher/event/html/PublisherHtmlApplicationSmokeTests.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package base.boudicca.publisher.event.html | ||
|
||
import org.junit.jupiter.api.Test | ||
import org.springframework.boot.test.context.SpringBootTest | ||
|
||
@SpringBootTest | ||
class PublisherHtmlApplicationSmokeTests { | ||
|
||
@Test | ||
fun contextLoads() { | ||
// This test will automatically pass if the application context loads successfully. | ||
// If there's any bean misconfiguration or other Spring-related errors, it will fail. | ||
} | ||
} |
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