Class SolrEnvironment

java.lang.Object
org.apache.solr.handler.admin.SolrEnvironment

public class SolrEnvironment extends Object
It is possible to define an environment code when starting Solr, through -Dsolr.environment=prod|stage|test|dev or by setting the cluster property "environment". This class checks if any of these are defined, and parses the string, which may also contain custom overrides for environment name (label) and color to be shown in Admin UI
  • Constructor Details

    • SolrEnvironment

      public SolrEnvironment()
  • Method Details

    • getCode

      public String getCode()
    • getLabel

      public String getLabel()
    • getColor

      public String getColor()
    • isDefined

      public boolean isDefined()
    • parse

      public static SolrEnvironment parse(String environmentString)
      Parse an environment string of format <prod|stage|test|dev> with an optional label and color as arguments
      Parameters:
      environmentString - the raw string to parse
      Returns:
      an instance of this object
    • getFromSyspropOrClusterprop

      public static SolrEnvironment getFromSyspropOrClusterprop(org.apache.solr.common.cloud.ZkStateReader zkStateReader)
      Gets and parses the solr environment configuration string from either System properties "solr.environment" or from Clusterprop "environment"
      Parameters:
      zkStateReader - pass in the zkStateReader if in cloud mode
      Returns:
      an instance of this class