You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by fp...@apache.org on 2021/05/19 04:52:44 UTC

[shiro-site] branch main updated: Add explanation about variable interpolation

This is an automated email from the ASF dual-hosted git repository.

fpapon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/shiro-site.git


The following commit(s) were added to refs/heads/main by this push:
     new 8b5b4ac  Add explanation about variable interpolation
     new 1817f5a  Merge pull request #82 from weltonrodrigo/patch-2
8b5b4ac is described below

commit 8b5b4acd29c34522cc24e0a0744e429e45637eed
Author: Welton Rodrigo Torres Nascimento <ro...@familianascimento.org>
AuthorDate: Mon May 17 21:32:33 2021 -0300

    Add explanation about variable interpolation
    
    This is a very useful feature for the docker world,
    but couldn't find any information about it in the docs.
    
    Co-authored-by: Brian Demers <br...@gmail.com>
---
 configuration.md.vtl | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/configuration.md.vtl b/configuration.md.vtl
index ae08db5..c21650f 100644
--- a/configuration.md.vtl
+++ b/configuration.md.vtl
@@ -25,6 +25,7 @@ Apache Shiro Configuration
                 *   [Nested Properties](#Configuration-NestedProperties)
                 *   [Byte Array Values](#Configuration-ByteArrayValues)
                 *   [Collection Properties](#Configuration-CollectionProperties)
+                *   [Variable Interpolation](#Configuration-VariableInterpolation)
 
             *   [Considerations](#Configuration-Considerations)
 
@@ -342,6 +343,26 @@ anObject.map = $objectKey1:$objectValue1, $objectKey2:$objectValue2
 ...
 ```
 
+<a name="Configuration-VariableInterpolation"></a>
+#[[######Variable Interpolation]]#
+
+You can use variable interpolation when defining values. Supported types are environment variables, system properties and constants.
+
+For constants, use `${const:com.example.YourClass.CONSTANT_NAME}`, for environment variables and system properties, use `${ENV_VARIABLE_NAME}` or `${system.property}`.
+
+System properties and environment variables are lookup up in that order.
+
+Default values are supported in the form `${const:com.example.YourClass.CONSTANT_NAME:-default_value`}, or `${VARIABLE_NAME:-default_value}`, as in:
+
+``` ini
+myRealm.connectionTimeout = ${REALM_CONNECTION_TIMEOUT:-3000}
+```
+
+Which will be interpreted as `myRealm.connectionTimeout = 3000` if no system property or environment variable `REALM_CONNECTION_TIMEOUT` is defined.
+
+If no replacement is found, the definition will remain unchanged.
+
+
 <a name="Configuration-Considerations"></a>
 #[[#####Considerations]]#