aboutsummaryrefslogtreecommitdiffstats
path: root/vnfs/DAaaS/microservices/GoApps/src/go-hdfs-writer/pkg/utils/hdfs-config.go
blob: ac33bc6a370c0f209e2068924672ec09d9deccfa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package utils

import (
	"os"
)

// SetHdfsParametersByObjectMap set the value of the hdfs config parameters
// and return HdfsConfig object
func SetHdfsParametersByObjectMap(m map[string]interface{}) HdfsConfig{

	hc := HdfsConfig{}
	hc.hdfsURL = m["hdfs_url"].(string)
	return hc

}

// SetHdfsParametersByEnvVariables sets the hdfs parameters
func SetHdfsParametersByEnvVariables() HdfsConfig {
	
	slogger := GetLoggerInstance()
	hdfsConfigObject := HdfsConfig{
		hdfsURL: os.Getenv("HDFS_URL"),
	}
	slogger.Infof("::hdfsURL:: %s", hdfsConfigObject.hdfsURL)
	return hdfsConfigObject
	
}

// HdfsConfig contains hdfs related config items
type HdfsConfig struct {
	hdfsURL string
}

// GetHdfsURL returns HdfsURL
func (h HdfsConfig) GetHdfsURL() string {
	return h.hdfsURL
}