Documentation

Trace:

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
jvx:code_snippets [2018/02/06 10:34]
admin
jvx:code_snippets [2019/05/03 09:24]
admin [Detect Production mode]
Line 2341: Line 2341:
     }     }
 } }
 +</​file>​
 +
 +==== Detect Production mode ====
 +
 +If you use the DBSecurityManager,​ it's possible to set the environment. The environment is a marker for the database connection, e.g.:
 +
 +<file xml>
 +<?xml version="​1.0"​ encoding="​UTF-8"?>​
 +
 +<​application>​
 +  <​securitymanager>​
 +    <​class>​com.sibvisions.rad.server.security.DBSecurityManager</​class>​
 +    <​environment>​prod</​environment>​
 +  </​securitymanager>​
 +  <​datasource>​
 +    <db name="​default">​
 +      <​url>​jdbc:​oracle:​thin:​@dbserver:​1521:​XE</​url>​
 +      <​username>​test</​username>​
 +      <​username_prod>​prod</​username_prod>​
 +      <​password>​test</​password>​
 +      <​password_prod>​prod</​password_prod>​
 +    </db>
 +  </​datasource>​
 +</​application>​
 +</​file>​
 +
 +The marker will be used as postfix for the detection of datasource credentials. In the example, the postfix is **prod** and the **username_prod** will be used instead of **username**. If not tag with environment postfix is available, the standard tag will be used. 
 +
 +If you want to use the environment in your source code, simply call:
 +
 +<file java>
 +String env = SessionContext.getCurrentSessionConfig().getProperty("/​application/​securitymanager/​environment"​);​
 </​file>​ </​file>​
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information