public void onRegister()

in services/minho-config-properties/src/main/java/org/apache/karaf/minho/config/properties/PropertiesConfigLoaderService.java [52:77]


    public void onRegister(final ServiceRegistry serviceRegistry) throws Exception {
        Properties properties = new Properties();
        File minhoProperties = new File("./minho.properties");
        if (System.getenv("MINHO_CONFIG") != null) {
            log.info("Loading properties from MINHO_CONFIG env variable");
            properties.load(new StringReader(System.getenv("MINHO_CONFIG")));
        } else if (System.getenv("MINHO_CONFIG_FILE") != null) {
            log.info("Loading configuration from " + System.getenv("MINHO_CONFIG_FILE"));
            properties.load(new FileInputStream(System.getenv("MINHO_CONFIG_FILE")));
        } else if (System.getProperty("minho.config") != null) {
            log.info("Loading configuration from " + System.getProperty("minho.config"));
            properties.load(new FileInputStream(System.getProperty("minho.config")));
        } else if (PropertiesConfigLoaderService.class.getResourceAsStream("/META-INF/minho.properties") != null) {
            log.info("Loading configuration from classpath META-INF/minho.properties");
            properties.load(PropertiesConfigLoaderService.class.getResourceAsStream("/META-INF/minho.properties"));
        } else if (PropertiesConfigLoaderService.class.getResourceAsStream("/minho.properties") != null) {
            log.info("Loading configuration from classpath minho.properties");
            properties.load(PropertiesConfigLoaderService.class.getResourceAsStream("/minho.properties"));
        } else if (minhoProperties.exists()){
            log.info("Loading configuration from current directory: ./minho.properties");
            properties.load(new FileReader(minhoProperties));
        }
        Config config = parse(properties);
        final var existing = serviceRegistry.get(Config.class);
        existing.merge(config);
    }