This page has been moved to a new location: Configuration Injection module.

3 Comments

  1. Since there is no Jira project yet, I'll paste a feedback/bug report from one of our prospects here:
    Use case: One of the properties I am attempting to set with this module is the publishing receiver: -Dmagnolia.inject.config="setProperty:/modules/publishing-core/config/receivers/magnoliaPublic8080,url,http://mgnlpublic:8080"

    After running it only sets the value to 'http' and ignores everything following the ':' character.

    Looking at the source code of info.magnolia.services.setup.ConfigInjectionModuleVersionHandler I see the following method:


    protected void parseConfig(List<Task> startupTasks, String config) { 
      startupTasks.add(new DebugTask("StartConfigInjection", "Starting config injection", "Starting config injection")); 
        for (String task : config.split(";")) { 
          String[] elts = task.split("[:,]"); 
          if (elts.length < 2) { 
            log.info("Invalid injection task: {}, skipping it", task); } 
          else { 
            InjectionOps op = InjectionOps.valueOf(elts[0]); 
          if (op == null) { 
            log.info("Unknown injection task: {}, skipping it", task); } 
          else { 
            startupTasks.add(op.createTask(Arrays.<String>copyOfRange(elts, 1, elts.length))); 
          } 
        } 
      } 
      startupTasks.add(new DebugTask("EndConfigInjection", "Config injection done!", "Configuration injection is done!")); 
    } 


    Generically splitting on ':' is the wrong thing to do here, a regular expression would be more appropriate.

    Perhaps something like the pattern: /([^:]+?):([^;]+);/g

  2. Good catch, Ondrej. And thanks for the prompt, Bradley. 

    I will turn around a fix per your suggestion and create a Jira project while I'm at it. 

    AW