com.quantifind.sumac

ConfigFromArg

trait ConfigFromArg extends PreParse with ConfigArgs

this mixin trait allows you to create the name of the config file to load from an argument on the command line. An application of this is to specify an environment on the command line and load different configurations based on the environment (prod, test, dev, ...), could also change depending on the user, or the server used, etc.

class ArgsWithEnv with ConfigFromArg {

var env: String = "dev"

useDefaultConfig = false
def makeConfigFilename(originalArgs: Map[String, String]): Option[String] = {
  originalArgs.get("env") match {
    case Some(e) => Some(e) //load $e.conf as configuration
    case _ => None
  }
}
}
Self Type
ConfigFromArg with Args
Linear Supertypes
ConfigArgs, PreParse, ExternalConfig, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. ConfigFromArg
  2. ConfigArgs
  3. PreParse
  4. ExternalConfig
  5. AnyRef
  6. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def configFilenameFromArg: Option[String]

    create the filename of the config file to load based on one, or multiple, command line argument(s).

    create the filename of the config file to load based on one, or multiple, command line argument(s). Override it as a def or a lazy val, but DO NOT use a val as it would just fix it to the value of the default.

    returns

    maybe a name of a config file.

  2. abstract def configPrefix: String

    the prefix to use to search for values in the config file.

    the prefix to use to search for values in the config file. The values will be searched with the key: configPrefix + '.' + argumentName

    returns

    the prefix to use. Should not include the trailing '.'

    Definition Classes
    ConfigArgs
  3. abstract def saveConfig(): Unit

    Definition Classes
    ExternalConfig

Concrete Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. def addConfig(filename: String): Unit

    add a config to the stack of files to load

    add a config to the stack of files to load

    filename

    Definition Classes
    ConfigArgs
  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. var configFiles: List[String]

    the list of config to loads, the rightmost config will be the preferred one, the others will be used as fallback.

    the list of config to loads, the rightmost config will be the preferred one, the others will be used as fallback. (in order from right to left)

    Definition Classes
    ConfigArgs
  10. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  13. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  14. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  15. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  16. def makeConfig(originalArgs: Map[String, String]): Config

    the Config to use to lookup values

    the Config to use to lookup values

    returns

    Definition Classes
    ConfigFromArgConfigArgs
  17. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  20. def readArgs(originalArgs: Map[String, String]): Map[String, String]

    Definition Classes
    ConfigArgs → ExternalConfig
  21. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  22. def toString(): String

    Definition Classes
    AnyRef → Any
  23. var useDefaultConfig: Boolean

    should the default config from typesafe lib (i.

    should the default config from typesafe lib (i.e. the one loaded by

    ConfigFactory.load()

    ) be the leftmost fallback in the configFiles list.

    ConfigFactory.load() }}} fallback in the configFiles list.

    Definition Classes
    ConfigArgs
  24. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  25. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from ConfigArgs

Inherited from PreParse

Inherited from ExternalConfig

Inherited from AnyRef

Inherited from Any

Ungrouped