Runtime properties renginering
This commit is contained in:
@@ -70,50 +70,31 @@
|
||||
<outputFolder>${project.build.directory}/generated-resources/css</outputFolder>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!--
|
||||
<plugin>
|
||||
<groupId>com.gitlab.haynes</groupId>
|
||||
<artifactId>libsass-maven-plugin</artifactId>
|
||||
<version>0.2.29</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<inputPath>${basedir}/src/main/sass/</inputPath>
|
||||
<inputSyntax>scss</inputSyntax>
|
||||
<outputPath>${project.build.directory}/${project.build.finalName}/css</outputPath>
|
||||
<generateSourceMap>true</generateSourceMap>
|
||||
<sourceMapOutputPath>${project.build.directory}/${project.build.finalName}/css</sourceMapOutputPath>
|
||||
</configuration>
|
||||
</plugin>
|
||||
-->
|
||||
<plugin>
|
||||
<groupId>org.eclipse.jetty</groupId>
|
||||
<artifactId>jetty-maven-plugin</artifactId>
|
||||
<version>${jetty.version}</version>
|
||||
<configuration>
|
||||
<scan>1</scan>
|
||||
<scan>0</scan>
|
||||
<httpConnector>
|
||||
<host>${pairgoth.webapp.host}</host>
|
||||
<port>${pairgoth.webapp.port}</port>
|
||||
</httpConnector>
|
||||
<!--
|
||||
<systemProperties>
|
||||
<pairgoth.api.url>${pairgoth.api.url}</pairgoth.api.url>
|
||||
<pairgoth.env>${pairgoth.env}</pairgoth.env>
|
||||
<pairgoth.api.external.url>${pairgoth.api.external.url}</pairgoth.api.external.url>
|
||||
<pairgoth.webapp.external.url>${pairgoth.webapp.external.url}</pairgoth.webapp.external.url>
|
||||
<pairgoth.store>${pairgoth.store}</pairgoth.store>
|
||||
<pairgoth.store.file.path>${pairgoth.store}</pairgoth.store.file.path>
|
||||
<pairgoth.logger.level>${pairgoth.logger.level}</pairgoth.logger.level>
|
||||
<pairgoth.logger.format>${pairgoth.logger.format}</pairgoth.logger.format>
|
||||
</systemProperties>
|
||||
-->
|
||||
<webApp>
|
||||
<contextPath>${pairgoth.webapp.context}/</contextPath>
|
||||
<resourceBases>${project.basedir}/src/main/webapp,${project.build.directory}/generated-resources/</resourceBases>
|
||||
</webApp>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
|
@@ -21,7 +21,7 @@ abstract class OAuthHelper {
|
||||
protected get() = WebappManager.getMandatoryProperty("oauth." + name + ".secret")
|
||||
protected val redirectURI: String?
|
||||
protected get() = try {
|
||||
val uri: String = WebappManager.Companion.getProperty("webapp.url") + "/oauth.html"
|
||||
val uri: String = WebappManager.Companion.getProperty("webapp.external.url") + "/oauth.html"
|
||||
URLEncoder.encode(uri, "UTF-8")
|
||||
} catch (uee: UnsupportedEncodingException) {
|
||||
logger.error("could not encode redirect URI", uee)
|
||||
|
@@ -11,8 +11,8 @@ class ApiTool {
|
||||
companion object {
|
||||
const val JSON = "application/json"
|
||||
val apiRoot =
|
||||
System.getProperty("pairgoth.api.url")?.let { "${it.removeSuffix("/")}/" }
|
||||
?: System.getProperty("pairgoth.webapp.url")?.let { "${it.removeSuffix("/")}/api/" }
|
||||
System.getProperty("pairgoth.api.external.url")?.let { "${it.removeSuffix("/")}/" }
|
||||
?: System.getProperty("pairgoth.webapp.external.url")?.let { "${it.removeSuffix("/")}/api/" }
|
||||
?: throw Error("no configured API url")
|
||||
}
|
||||
private val client = OkHttpClient()
|
||||
|
@@ -63,11 +63,11 @@ class WebappManager : ServletContextListener, ServletContextAttributeListener, H
|
||||
properties[(key as String).removePrefix(PAIRGOTH_PROPERTIES_PREFIX)] = value
|
||||
}
|
||||
|
||||
val env = properties.getProperty("webapp.env")
|
||||
val env = properties.getProperty("env")
|
||||
logger.info("Using profile {}", )
|
||||
|
||||
// let the view be aware of the environment
|
||||
context.setAttribute("webapp.env", env)
|
||||
context.setAttribute("env", env)
|
||||
|
||||
// set system user agent string to empty string
|
||||
System.setProperty("http.agent", "")
|
||||
@@ -114,10 +114,10 @@ class WebappManager : ServletContextListener, ServletContextAttributeListener, H
|
||||
return properties.getProperty(prop)
|
||||
}
|
||||
fun getMandatoryProperty(prop: String): String {
|
||||
return properties.getProperty(prop) ?: throw Error("missing property: ${prop}")
|
||||
return getProperty(prop) ?: throw Error("missing property: ${prop}")
|
||||
}
|
||||
|
||||
val webappURL by lazy { getProperty("webapp.url") }
|
||||
val webappURL by lazy { getProperty("webapp.external.url") }
|
||||
|
||||
private val services = mutableMapOf<String, Pair<Runnable, Thread>>()
|
||||
|
||||
|
Reference in New Issue
Block a user