Packages

  • package root
    Definition Classes
    root
  • package args4c

    Args4c (arguments for configuration) is intended to add some helpers and utilities in obtaining a typesafe configuration from user arguments.

    Args4c (arguments for configuration) is intended to add some helpers and utilities in obtaining a typesafe configuration from user arguments.

    The core is simply to convert an Array[String] to a Config where the arguments are either paths to configuration resources or simple key=value pairs via args4c.configForArgs

    Left-most arguments take precedence. In this example, we assume 'prod.conf' is a resource on the classpath:

    MyApp foo.x=bar foo.x=ignored /opt/etc/overrides.conf prod.conf

    In addition to this core concept, this library also provides some additional configuration utilities via args4c.RichConfigOps which can be made available by extending args4c.LowPriorityArgs4cImplicits or importing args4c.implicits:

    import args4c.implicits._
    object MyApp {
       override def main(args : Array[String]) : Unit = {
         val config = args.asConfig()
         println("Starting MyApp with config:")
    
         // let's "log" our app's config on startup:
         val flatSummary : String = config.filter(_.startsWith("myapp")).summary()
         println(flatSummary) // "logging" our config
       }
    }

    Where the 'summary' will produce sorted args4c.StringEntry values with potentially sensitive entries (e.g. passwords) obscured and a source comment for some sanity as to where each entry comes from:

    myapp.foo : bar # command-line
    myapp.password : **** obscured **** # command-line
    myapp.saveTo : afile # file:/opt/etc/myapp/test.conf@3

    Also, when extracting user arguments into a configuration, an additional 'fallback' config is specified. Typically this would just be the ConfigFactory.load() configuration, but args4c uses the args4c.defaultConfig, which is essentially just the system environment variables converted from snake-caes to dotted lowercase values first, then falling back on ConfigFactory.load().

    Applications can elect to not have this behaviour and provide their own fallback configs when parsing args, but the default provides a convenience for system environment variables to override e.g. 'foo.bar.x=default' by specifying

    FOO_BAR_X=override

    as a system environment variable. Otherwise you may end up having to repeat this sort of thing all over you config:

    foo.bar=default
    foo.bar=$${?FOO_BAR}
    
    foo.bazz=default2
    foo.bazz=$${?FOO_BAZZ}
    
    ...

    Finally, args4c also provides a args4c.ConfigApp which provides some additional functionality to configuration-based applications.

    Definition Classes
    root
  • ConfigApp
  • Encryption
  • LowPriorityArgs4cImplicits
  • PasswordPrompt
  • Prompt
  • PromptForConfigFilePermissions
  • PromptForExistingPassword
  • PromptForPassword
  • PromptForUpdatedPassword
  • ReadNextKeyValuePair
  • ReadNextKeyValuePairAfterError
  • RichConfig
  • RichConfigOps
  • SaveSecretPrompt
  • SecureConfig
  • Selected
  • StringEntry
  • implicits

object SecureConfig extends Serializable

Makes available a means to initialize a sensitive, encrypted config file via SecureConfig.setupSecureConfig and ConfigApp.secureConfigForArgs

The idea is that a (service) user-only readable, password-protected AES encrypted config file can be set up via reading entries from standard input, and an application an use those configuration entries thereafter by taking the password from standard input.

Linear Supertypes
Serializable, Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. SecureConfig
  2. Serializable
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. val SecureEnvVariableName: String

    The environment variable which, if set, will be used to decrypt an encrypted config file (e.g.

    The environment variable which, if set, will be used to decrypt an encrypted config file (e.g. "--secure" for the default or "--secure=password.conf" for specifying one)

  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  7. def defaultSecureConfigPath(workDir: String = Properties.userDir): String
  8. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  9. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  10. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  11. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  12. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  13. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  14. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  16. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  17. def readConfigAtPath(path: Path, pwd: Array[Byte]): Config
  18. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  19. def toString(): String
    Definition Classes
    AnyRef → Any
  20. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from Serializable

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped