Skip to content

Commit

Permalink
#1235 License key renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoraboeuf committed Oct 28, 2024
1 parent 6b3dd2a commit 64cfdd9
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import org.springframework.stereotype.Component
@ConfigurationProperties(prefix = "ontrack.config.license.embedded")
@Component
class EmbeddedLicenseConfigurationProperties {
var license: String? = null
var key: String? = null
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ class EmbeddedLicenseService(
) : AbstractSignatureLicenseService() {

override val licenseType: String = "Embedded"
override val encodedLicense: String? = embeddedLicenseConfigurationProperties.license
override val encodedLicense: String? = embeddedLicenseConfigurationProperties.key
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package net.nemerosa.ontrack.extension.license.settings

data class LicenseSettings(
val license: String,
val key: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class LicenseSettingsManager(
) {

override fun doSaveSettings(settings: LicenseSettings) {
settingsRepository.setString<LicenseSettings>(settings::license)
settingsRepository.setString<LicenseSettings>(settings::key)
}

override fun getId(): String = "license"
Expand All @@ -37,6 +37,6 @@ class LicenseSettingsManager(
@Deprecated("Deprecated in Java")
override fun getSettingsForm(settings: LicenseSettings): Form =
Form.create()
.memoField(LicenseSettings::license, settings.license)
.memoField(LicenseSettings::key, settings.key)

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class LicenseSettingsProvider(
) : SettingsProvider<LicenseSettings> {

override fun getSettings() = LicenseSettings(
license = settingsRepository.getString(LicenseSettings::license, ""),
key = settingsRepository.getString(LicenseSettings::key, ""),
)

override fun getSettingsClass(): Class<LicenseSettings> = LicenseSettings::class.java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ class SettingsLicenseService(
override val licenseType: String = "Settings"

override val encodedLicense: String?
get() = cachedSettingsService.getCachedSettings(LicenseSettings::class.java).license
get() = cachedSettingsService.getCachedSettings(LicenseSettings::class.java).key

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SignatureLicenseServiceTest {
fun `No license content provided`() {
val service = EmbeddedLicenseService(
EmbeddedLicenseConfigurationProperties().apply {
license = null
key = null
}
)
assertFailsWith<SignatureLicenseException> {
Expand All @@ -29,7 +29,7 @@ class SignatureLicenseServiceTest {
fun `License OK`() {
val service = EmbeddedLicenseService(
EmbeddedLicenseConfigurationProperties().apply {
license =
key =
"eyJkYXRhIjoiZXlKdVlXMWxJam9pVUhKbGJXbDFiU0lzSW1GemMybG5ibVZsSWpvaVRtVnRaWEp2YzJFaUxDSjJZV3hwWkZWdWRHbHNJanB1ZFd4c0xDSnRZWGhRY205cVpXTjBjeUk2TUN3aVptVmhkSFZ5WlhNaU9sc2laWGgwWlc1emFXOXVMbVZ1ZG1seWIyNXRaVzUwY3lKZGZRPT0iLCJzaWduYXR1cmUiOiJNRVlDSVFEeUxkUFhBL1k0RjdzR0V1V3RUN3laa0gzQnVMMWZ6S0hRV3hnRDJVSm12UUloQU1seXFxblZkdXpPcEx6VVVyV1N5anNqNU1LVE9WYlRSdTFCam9jZXlqRWUifQ=="
}
)
Expand Down
12 changes: 2 additions & 10 deletions ontrack-web-core/components/framework/settings/license-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,8 @@ export default function LicenseForm({id, ...values}) {
<>
<SettingsForm id={id} values={values}>
<Form.Item
name="license"
label="License"
extra="License key"
>
<Input.TextArea/>
</Form.Item>
<Form.Item
name="signature"
label="Signature"
extra="Signature key"
name="key"
label="License key"
>
<Input.TextArea/>
</Form.Item>
Expand Down

0 comments on commit 64cfdd9

Please sign in to comment.