Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make developing the frontend more fun by configuring the devtools a bit #562

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ nb-configuration.xml
testdata.dump
/boudicca.store
/fetcher.cache

out/
13 changes: 13 additions & 0 deletions .run/BETA - OnlineHtmlPublisher.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="BETA - OnlineHtmlPublisher" type="Application" factoryName="Application">
<envs>
<env name="BOUDICCA_SEARCH_URL" value="https://search.boudicca.events" />
<env name="BOUDICCA_LOCALMODE" value="true" />
</envs>
<option name="MAIN_CLASS_NAME" value="base.boudicca.publisher.event.html.PublisherHtmlApplicationKt" />
<module name="boudicca.boudicca.base.publisher-event-html.main" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
6 changes: 3 additions & 3 deletions boudicca.base/publisher-event-html/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## Start application

```
gradlew bootRun or ./gradlew bootRun
```
There is the new Launch config `BETA - OnlineHtmlPublisher` you can run/debug.
To reload the application after you made changes you can build the project via `Build -> Build Project` or pressing Ctrl+F9.
To make this rebuild and reload even faster you can change your settings in `Settings -> Build, Execution, Deployment -> Gradle -> Build and run using: ` to build with Intellij instead of Gradle.

## Stack

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ package base.boudicca.publisher.event.html
import base.boudicca.publisher.event.html.extension.HeaderExtensionValueResolver
import base.boudicca.publisher.event.html.handlebars.HandlebarsViewResolver
import com.github.jknack.handlebars.ValueResolver
import com.github.jknack.handlebars.cache.NullTemplateCache
import com.github.jknack.handlebars.helper.ConditionalHelpers
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.runApplication
import org.springframework.context.annotation.Bean
import org.springframework.scheduling.annotation.EnableScheduling
Expand All @@ -13,16 +15,25 @@ import org.springframework.web.servlet.ViewResolver

@SpringBootApplication
@EnableScheduling
@EnableConfigurationProperties(PublisherHtmlProperties::class)
class PublisherHtmlApplication {
@Bean
fun handlebarsViewResolver(headerExtensionValueResolver: HeaderExtensionValueResolver): ViewResolver {
fun handlebarsViewResolver(
headerExtensionValueResolver: HeaderExtensionValueResolver,
properties: PublisherHtmlProperties
): ViewResolver {
val viewResolver = HandlebarsViewResolver()

for (helper in ConditionalHelpers.entries) {
viewResolver.registerHelper(helper.name, helper)
}

viewResolver.setPrefix("classpath:/templates")

if (properties.localMode) {
viewResolver.setCacheFilter { _, _, _ -> false }
viewResolver.setTemplateCache(NullTemplateCache.INSTANCE)
}

val valueResolvers = ValueResolver.defaultValueResolvers().union(listOf(headerExtensionValueResolver))
viewResolver.setValueResolvers(*valueResolvers.toTypedArray())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package base.boudicca.publisher.event.html

import org.springframework.boot.context.properties.ConfigurationProperties

@ConfigurationProperties(prefix = "boudicca")
data class PublisherHtmlProperties(
val localMode: Boolean = false,
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#logging.level.ROOT: DEBUG
server.port=8080
boudicca.search.url=http://localhost:8082
boudicca.search.additionalFilter=
boudicca.search.additionalFilter=
spring.devtools.restart.exclude=static/**,templates/**
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties

@ConfigurationProperties(prefix = "boudicca")
data class BoudiccaSearchProperties(
val localMode: Boolean,
val localMode: Boolean = false,
val eventDB: EventDBProperties,
)

Expand Down
Loading