2 * Copyright 2018 Intel Corporation, Inc
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
24 // SMSConfiguration loads up all the values that are used to configure
25 // backend implementations
26 // TODO: Review these and see if they can be created/discovered dynamically
27 type SMSConfiguration struct {
28 CAFile string `json:"cafile"`
29 ServerCert string `json:"servercert"`
30 ServerKey string `json:"serverkey"`
32 VaultAddress string `json:"vaultaddress"`
33 VaultToken string `json:"vaulttoken"`
36 // SMSConfig is the structure that stores the configuration
37 var SMSConfig *SMSConfiguration
39 // ReadConfigFile reads the specified smsConfig file to setup some env variables
40 func ReadConfigFile(file string) (*SMSConfiguration, error) {
42 f, err := os.Open(file)
47 decoder := json.NewDecoder(f)
48 err = decoder.Decode(&SMSConfig)