Browse Source

Merge pull request #177 from laodc/master

Added SERVER_(SUB)VERSION to banner variables
master
Neil 8 years ago
committed by GitHub
parent
commit
9ec2f22306
  1. 6
      docs/ENVIRONMENT.rst
  2. 5
      server/session.py

6
docs/ENVIRONMENT.rst

@ -116,8 +116,10 @@ These environment variables are optional:
You can place several meta-variables in your banner file, which will be You can place several meta-variables in your banner file, which will be
replaced before serving to a client. replaced before serving to a client.
+ **$VERSION** is replaced with the ElectrumX version you are + **$SERVER_VERSION** is replaced with the ElectrumX version you are
runnning, such as *ElectrumX 0.9.22*. runnning, such as *1.0.10*.
+ **$SERVER_SUBVERSION** is replaced with the ElectrumX user agent
string. For example, `ElectrumX 1.0.10`.
+ **$DAEMON_VERSION** is replaced with the daemon's version as a + **$DAEMON_VERSION** is replaced with the daemon's version as a
dot-separated string. For example *0.12.1*. dot-separated string. For example *0.12.1*.
+ **$DAEMON_SUBVERSION** is replaced with the daemon's user agent + **$DAEMON_SUBVERSION** is replaced with the daemon's user agent

5
server/session.py

@ -288,8 +288,11 @@ class ElectrumX(SessionBase):
minor, revision = divmod(minor, 10000) minor, revision = divmod(minor, 10000)
revision //= 100 revision //= 100
daemon_version = '{:d}.{:d}.{:d}'.format(major, minor, revision) daemon_version = '{:d}.{:d}.{:d}'.format(major, minor, revision)
server_version = version.VERSION.split()[-1]
for pair in [ for pair in [
('$VERSION', version.VERSION), ('$VERSION', version.VERSION), # legacy
('$SERVER_VERSION', server_version),
('$SERVER_SUBVERSION', version.VERSION),
('$DAEMON_VERSION', daemon_version), ('$DAEMON_VERSION', daemon_version),
('$DAEMON_SUBVERSION', network_info['subversion']), ('$DAEMON_SUBVERSION', network_info['subversion']),
('$DONATION_ADDRESS', self.env.donation_address), ('$DONATION_ADDRESS', self.env.donation_address),

Loading…
Cancel
Save