Does B4G accept to pass properties file as a command parameter?
search cancel

Does B4G accept to pass properties file as a command parameter?

book

Article ID: 432872

calendar_today

Updated On:

Products

Endevor

Issue/Introduction

When we have truststore and password information to start B4G, for security reason it is not desired to have it exposed.

So does B4G accept to pass properties file as a command parameter?

 

Resolution

Define those initialization parameters in the service definition and avoid specifying them every time you start it.
 
Suggestion example:
 
[Unit]
Description=Endevor Bridge for Git
After=syslog.target
After=network.target
# when using PostgreSQL as a database
#Wants=postgresql.service
#After=postgresql.service


[Service]
Type=simple
ExecStart=/bin/java -jar BridgeForGit-1.2.3.jar  -Djavax.net.ssl.trustStore=/home/bfg/bridge.jks -Djavax.net.ssl.trustStorePassword=mypass
Restart=on-failure
RestartSec=60
User=xxxx
Group=xxxx
WorkingDirectory=/opt/bfg


[Install]
WantedBy=multi-user.target
 
 
To start the service, run the command `sudo systemctl start bridge`
 

 

Since it is a Linux server, follow first suggestion and run Bridge as a service. Subsequently, if you want to hide secrets from the service file as well, create an extra file for them:

/etc/bridge/secrets.conf.

The file's content consists of variables and values for all the secrets:

example:

TSPASS=mypass

Ensure permissions are restricted to the right user and group; using the above suggestion, this is the bridge user.

chown bridge:bridge /etc/bridge/secrets.conf
chmod 600 /etc/bridge/secrets.conf

 

Finally, use the secrets file in the service configuration:

[Service]

EnvironmentFile=/etc/bridge/secrets.conf
ExecStart=/bin/java -Djavax.net.ssl.trustStore=/home/bfg/bridge.jks -Djavax.net.ssl.trustStorePassword=${TSPASS} -jar BridgeForGit-1.2.3.jar