diff --git a/clowder/clowder_test.go b/clowder/clowder_test.go index b4c226c..c68d619 100644 --- a/clowder/clowder_test.go +++ b/clowder/clowder_test.go @@ -1,3 +1,17 @@ +// Copyright 2024 Red Hat, Inc +// +// 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 +// +// http://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. + package clowder_test import ( diff --git a/clowder/export_test.go b/clowder/export_test.go index 6dd3c81..8556f2d 100644 --- a/clowder/export_test.go +++ b/clowder/export_test.go @@ -1,3 +1,17 @@ +// Copyright 2024 Red Hat, Inc +// +// 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 +// +// http://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. + package clowder var ( diff --git a/clowder/kafka.go b/clowder/kafka.go index 35b63d0..8a2bfe6 100644 --- a/clowder/kafka.go +++ b/clowder/kafka.go @@ -1,3 +1,17 @@ +// Copyright 2024 Red Hat, Inc +// +// 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 +// +// http://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. + package clowder import ( @@ -13,6 +27,8 @@ const ( noTopicMapping = "warning: no kafka mapping found for topic %s" ) +// UseBrokerConfig tries to replace parts of the BrokerConfiguration with the values +// loaded by Clowder func UseBrokerConfig(brokerCfg *kafka.BrokerConfiguration, loadedConfig *api.AppConfig) { // make sure broker(s) are configured in Clowder if loadedConfig.Kafka != nil && len(loadedConfig.Kafka.Brokers) > 0 { @@ -46,6 +62,9 @@ func UseBrokerConfig(brokerCfg *kafka.BrokerConfiguration, loadedConfig *api.App fmt.Println(noBrokerConfig) } } + +// UseClowderTopics tries to replace the configured topic with the corresponding +// topic loaded by Clowder func UseClowderTopics(configuration *kafka.BrokerConfiguration, kafkaTopics map[string]api.TopicConfig) { // Get the correct topic name from clowder mapping if available if clowderTopic, ok := kafkaTopics[configuration.Topic]; ok { diff --git a/clowder/storage.go b/clowder/storage.go index 2c543cc..ec35738 100644 --- a/clowder/storage.go +++ b/clowder/storage.go @@ -1,3 +1,17 @@ +// Copyright 2024 Red Hat, Inc +// +// 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 +// +// http://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. + package clowder import ( @@ -5,6 +19,8 @@ import ( api "github.com/redhatinsights/app-common-go/pkg/api/v1" ) +// UseDBConfig tries to replace the StorageConfiguration parameters with the +// values loaded by Clowder func UseDBConfig(storageCfg *postgres.StorageConfiguration, loadedConfig *api.AppConfig) { storageCfg.PGDBName = loadedConfig.Database.Name storageCfg.PGHost = loadedConfig.Database.Hostname diff --git a/kafka/scram_client.go b/kafka/scram_client.go index b135069..dc3755f 100644 --- a/kafka/scram_client.go +++ b/kafka/scram_client.go @@ -1,3 +1,17 @@ +// Copyright 2024 Red Hat, Inc +// +// 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 +// +// http://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. + package kafka import "github.com/xdg/scram" diff --git a/postgres/config.go b/postgres/config.go index 5dbf956..14bfd3d 100644 --- a/postgres/config.go +++ b/postgres/config.go @@ -1,3 +1,17 @@ +// Copyright 2024 Red Hat, Inc +// +// 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 +// +// http://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. + package postgres // StorageConfiguration represents common configuration of data storage