Class EnvSupport


  • public class EnvSupport
    extends java.lang.Object
    Environment variables could be used to personalize updating yaml file. For example:
     some:
        - prop: #{var}
     

    Such syntax allows yaml parser to treat variable as a comment (if it would not be replaced). Also, variables in format ${va} are often used directly in the configuration (to be replaced at runtime with environment variables).

    Variable names are case-sensitive. Unknown variables are not replaced. Null values replaced with empty.

    Since:
    08.06.2021
    • Constructor Summary

      Constructors 
      Constructor Description
      EnvSupport​(java.lang.String prefix, java.lang.String postfix, java.util.Map<java.lang.String,​java.lang.String> env)  
      EnvSupport​(java.util.Map<java.lang.String,​java.lang.String> env)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String apply​(java.lang.String text)
      Replace variables in the provided text.
      java.util.Map<java.lang.String,​java.lang.String> getApplied()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • EnvSupport

        public EnvSupport​(java.util.Map<java.lang.String,​java.lang.String> env)
      • EnvSupport

        public EnvSupport​(java.lang.String prefix,
                          java.lang.String postfix,
                          java.util.Map<java.lang.String,​java.lang.String> env)
    • Method Detail

      • apply

        public java.lang.String apply​(java.lang.String text)
        Replace variables in the provided text.
        Parameters:
        text - text to process
        Returns:
        text with replaced known variables
      • getApplied

        public java.util.Map<java.lang.String,​java.lang.String> getApplied()
        Returns:
        applied variables in the latest execution or empty map