Skip to content

Commit

Permalink
refactor(config): Split the configuration of secret providers
Browse files Browse the repository at this point in the history
Move the provider-specific configuration settings from the
configuration file of the SPI module to separate `application.conf`
files in the provider modules. That way, the SPI module does not need
knowledge about provider-specific options.

Signed-off-by: Oliver Heger <[email protected]>
  • Loading branch information
oheger-bosch committed Nov 22, 2024
1 parent bfc1c3b commit 46aec01
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 17 deletions.
20 changes: 20 additions & 0 deletions secrets/file/src/main/resources/application.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (C) 2024 The ORT Server Authors (See <https://github.com/eclipse-apoapsis/ort-server/blob/main/NOTICE>)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# License-Filename: LICENSE

secretsProvider {
fileBasedPath = ${?FILE_BASED_PATH}
}
24 changes: 24 additions & 0 deletions secrets/scaleway/src/main/resources/application.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Copyright (C) 2024 The ORT Server Authors (See <https://github.com/eclipse-apoapsis/ort-server/blob/main/NOTICE>)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# License-Filename: LICENSE

secretsProvider {
scwServerUrl = ${?SCW_SERVER_URL}
scwApiVersion = ${?SCW_API_VERSION}
scwRegion = ${?SCW_REGION}
scwSecretKey = ${?SCW_SECRET_KEY}
scwProjectId = ${?SCW_PROJECT_ID}
}
18 changes: 1 addition & 17 deletions secrets/spi/src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,5 @@ secretsProvider {
name = "vault"
name = ${?SECRETS_PROVIDER_NAME}

# Properties for the Vault provider.
vaultUri = ${?VAULT_URI}
vaultRoleId = ${?VAULT_ROLE_ID}
vaultSecretId = ${?VAULT_SECRET_ID}
vaultRootPath = ${?VAULT_ROOT_PATH}
vaultPrefix = ${?VAULT_PREFIX}
vaultNamespace = ${?VAULT_NAMESPACE}

# Properties for the file-based provider.
fileBasedPath = ${?FILE_BASED_PATH}

# Properties for the Scaleway provider.
scwServerUrl = ${?SCW_SERVER_URL}
scwApiVersion = ${?SCW_API_VERSION}
scwRegion = ${?SCW_REGION}
scwSecretKey = ${?SCW_SECRET_KEY}
scwProjectId = ${?SCW_PROJECT_ID}
# Concrete provider implementations can define additional properties in their own configuration files.
}
25 changes: 25 additions & 0 deletions secrets/vault/src/main/resources/application.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (C) 2024 The ORT Server Authors (See <https://github.com/eclipse-apoapsis/ort-server/blob/main/NOTICE>)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# License-Filename: LICENSE

secretsProvider {
vaultUri = ${?VAULT_URI}
vaultRoleId = ${?VAULT_ROLE_ID}
vaultSecretId = ${?VAULT_SECRET_ID}
vaultRootPath = ${?VAULT_ROOT_PATH}
vaultPrefix = ${?VAULT_PREFIX}
vaultNamespace = ${?VAULT_NAMESPACE}
}

0 comments on commit 46aec01

Please sign in to comment.