Last active
April 23, 2021 22:16
-
-
Save ZieIony/e4370e7dee0db302408bbee50d462c7a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const val PROPERTY_SLACK_TOKEN = "slack.token" | |
data class ToolsProperties( | |
val slackToken: String, | |
) { | |
companion object { | |
fun parseProperties(propertiesFileName: String): ToolsProperties { | |
val properties = Properties() | |
val stream = FileInputStream(propertiesFileName) | |
properties.load(stream) | |
stream.close() | |
return parseProperties(properties) | |
} | |
fun parseProperties(properties: Properties): ToolsProperties { | |
val slackToken = properties.getProperty(PROPERTY_SLACK_TOKEN, null) | |
?: throw MissingPropertyException("Property $PROPERTY_SLACK_TOKEN is missing") | |
return ToolsProperties(slackToken) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment