Search in sources :

Example 1 with Config

use of com.networknt.config.Config in project light-4j by networknt.

the class RegistryTest method setUp.

// @BeforeClass
public static void setUp() throws Exception {
    // inject server config here.
    Config config = Config.getInstance();
    // write a config file into the user home directory
    Map<String, Object> map = new HashMap<String, Object>();
    map.put("description", "server config");
    map.put("enableHttp", true);
    map.put("ip", "0.0.0.0");
    map.put("httpPort", 8080);
    map.put("enableHttps", true);
    map.put("httpsPort", 8443);
    map.put("keystoreName", "tls/server.keystore");
    map.put("keystorePass", "secret");
    map.put("keyPass", "secret");
    map.put("serviceId", "com.networknt.apia-1.0.0");
    map.put("enableRegistry", true);
    addURL(new File(homeDir).toURI().toURL());
    config.getMapper().writeValue(new File(homeDir + "/server.json"), map);
    if (server == null) {
        logger.info("starting server");
        Server.start();
    }
}
Also used : HashMap(java.util.HashMap) Config(com.networknt.config.Config) File(java.io.File)

Aggregations

Config (com.networknt.config.Config)1 File (java.io.File)1 HashMap (java.util.HashMap)1