2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.webseal.simulator.conf;
23 import com.typesafe.config.Config;
24 import com.typesafe.config.ConfigFactory;
25 import org.openecomp.sdc.webseal.simulator.User;
28 import java.util.HashMap;
29 import java.util.List;
34 private static Conf conf= null;
35 private String feHost;
36 Map<String,User> users = new HashMap<String,User>();
42 private void initConf() {
44 String confPath = System.getProperty("config.resource");
45 if (confPath == null){
46 System.out.println("config.resource is empty - goint to get it from config.home");
47 confPath = System.getProperty("config.home") + "/webseal.conf";
49 System.out.println("confPath=" + confPath );
50 Config confFile = ConfigFactory.parseFileAnySyntax(new File(confPath));
51 Config resolve = confFile.resolve();
52 setFeHost(resolve.getString("webseal.fe"));
53 List<? extends Config> list = resolve.getConfigList("webseal.users");
54 for (Config conf : list ){
55 String userId = conf.getString("userId");
56 String password = conf.getString("password");
57 String firstName = conf.getString("firstName");
58 String lastName = conf.getString("lastName");
59 String email = conf.getString("email");
60 String role = conf.getString("role");
61 users.put(userId,new User(firstName,lastName,email,userId,role,password));
69 public static Conf getInstance(){
76 public String getFeHost() {
80 public void setFeHost(String feHost) {
84 public Map<String,User> getUsers() {