package leigh.esp.sdk.service;

import leigh.eo.EO;
import leigh.esp.sdk.service.schema.v1.MicroServiceCfgElementDAO;

/**
 * Simple runtime to launch an Enhanced Services Platform (ESP) microservice. This is intended to consolidate
 * at least some of the boilerplate that otherwise would be required to be in the <code>main()</code> method of
 * every microservice.
 *
 * @author Alex Leigh
 */
public class MicroServiceEnvironment {
    /**
     * Return the MicroServices configuration for this environment, helped by the provided arguments. The arguments
     * are expected to be the Kabe URL and the Source URL.
     */
    public static EO getCfg(String[] args) {
        EO cfg = MicroServiceCfgElementDAO.create();
        MicroServiceCfgElementDAO.setKabeUrl(cfg, args[0]);
        MicroServiceCfgElementDAO.setSrcUri(cfg, args[1]);
        return cfg;
    }
}
