-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Refactoring and add PDFGenCore initializer method (#10)
* Initializer: make it possible to initalize PDFGenCore with additional handlebar helpers * Update and add handlebar helpers * Fix tests and linting * Update json_to_period to support json payload * Add tests and update README.md * Change environment variabel to be privat * Better errorhandling when resource file does not exists
- Loading branch information
Showing
13 changed files
with
508 additions
and
99 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
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,21 @@ | ||
package no.nav.pdfgen.core | ||
|
||
import io.github.oshai.kotlinlogging.KotlinLogging | ||
import java.util.concurrent.atomic.AtomicReference | ||
|
||
private val coreEnvironment = AtomicReference(Environment()) | ||
private val log = KotlinLogging.logger {} | ||
|
||
class PDFGenCore { | ||
companion object { | ||
fun init(initialEnvironment: Environment) { | ||
coreEnvironment.set(initialEnvironment) | ||
} | ||
|
||
val environment: Environment get() = coreEnvironment.get() | ||
fun reloadEnvironment() { | ||
log.debug { "Reloading environment" } | ||
coreEnvironment.set(coreEnvironment.get().copy()) | ||
} | ||
} | ||
} |
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
Oops, something went wrong.