code: public void addChainConfig(ChainConfig chainCfg, boolean recursive, String before) throws Exception {
          long startTime = System.currentTimeMillis();
          Exception exception = null;
          if (!cfg.exists()) {
              init();
          }
          userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
          System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());
          try {
              ConfigurationManager manager = new ConfigurationManager(cfg, false);
  
              ProjectConfigurationProvider cfgProvider = manager.getProjectConfigurationProvider();
  
              cfgProvider.addChainConfig(chainCfg, recursive, before);
          } catch (Exception e) {
              exception = e;
          } finally {
              System.setProperty("user.dir", userDir);
              updateMsg(startTime, exception);
          }
      }
docs: Adds a new chain configuration into the configuration file
  
  @param chainCfg
  chain configuration to add
  @param recursive
  Adds the new chain into all the submodules
  @param before
  Decides which is the next chain to execute.
  @throws Exception
  in case that the walkmod configuration file can't be read.