-
Notifications
You must be signed in to change notification settings - Fork 0
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 #126 from Opetushallitus/OK-636-europass-publisher…
…-build OK-636, OK-758: europass-publisher docker image build
- Loading branch information
Showing
11 changed files
with
150 additions
and
30 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
7 changes: 7 additions & 0 deletions
7
...ublisher/src/main/resources/oph-configuration/kouta-external-europass.properties.template
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 @@ | ||
europass-publisher.elasticsearch.url = {{kouta_external_elasticsearch7_url}} | ||
europass-publisher.elasticsearch.username = {{kouta_external_elasticsearch_username}} | ||
europass-publisher.elasticsearch.password = {{kouta_external_elasticsearch_password}} | ||
europass-publisher.s3.region = eu-west-1 | ||
europass-publisher.s3.bucketname = europass-publish-{{ env("ENV_NAME") }} | ||
europass-publisher.s3.keyname = europass-export-1.xml | ||
europass-publisher.s3.endpoint = |
32 changes: 28 additions & 4 deletions
32
europass-publisher/src/main/scala/fi/oph/kouta/europass/EuropassConfiguration.scala
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,8 +1,32 @@ | ||
package fi.oph.kouta.europass | ||
|
||
import com.typesafe.config.ConfigFactory | ||
import fi.oph.kouta.logging.Logging | ||
import com.typesafe.config.{Config, ConfigFactory} | ||
import java.io.File | ||
|
||
object EuropassConfiguration { | ||
lazy val config = ConfigFactory.load("europass-publisher") | ||
.withFallback(ConfigFactory.load("default")) | ||
object EuropassConfiguration extends Logging { | ||
def classPathUrls(cl: ClassLoader): Array[java.net.URL] = cl match { | ||
case null => Array() | ||
case u: java.net.URLClassLoader => u.getURLs() ++ classPathUrls(cl.getParent) | ||
case _ => classPathUrls(cl.getParent) | ||
} | ||
|
||
def createConfig(): Config = { | ||
logger.info("Reading configuration from classpath: " + | ||
classPathUrls(getClass.getClassLoader).mkString(", ")) | ||
|
||
val configFile = new File(System.getProperty("user.home") + | ||
"/oph-configuration/kouta-external-europass.properties") | ||
val templatedConfig = if (configFile.exists()) { | ||
ConfigFactory.load(ConfigFactory.parseFile(configFile)) | ||
} else { | ||
logger.warn("Actual config file kouta-external-europass.properties not found") | ||
ConfigFactory.load() | ||
} | ||
val localConfig = ConfigFactory.load("europass-publisher") | ||
val fallbackConfig = ConfigFactory.load("default") | ||
return templatedConfig.withFallback(localConfig).withFallback(fallbackConfig) | ||
} | ||
|
||
lazy val config = createConfig() | ||
} |
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
24 changes: 24 additions & 0 deletions
24
europass-publisher/src/test/scala/fi/oph/kouta/europass/test/ElasticFixture.scala
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,24 @@ | ||
package fi.oph.kouta.europass.test | ||
|
||
import org.scalatest.{BeforeAndAfterAll, Suite} | ||
import scala.sys.process.Process | ||
|
||
trait ElasticFixture extends BeforeAndAfterAll { this: Suite => | ||
|
||
private def useFixture(): Boolean = | ||
!(System.getenv("TEST_USE_PRERUN_ELASTIC") == "true") | ||
|
||
override def beforeAll() { | ||
if (useFixture()) { | ||
Process("docker-compose up -d kouta-elastic europass-s3").! | ||
Process("docker-compose up elasticdump-loader s3-configurator").! | ||
} | ||
} | ||
|
||
override def afterAll() { | ||
if (useFixture()) { | ||
Process("docker-compose down").! | ||
} | ||
} | ||
|
||
} |
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