Skip to content

Commit

Permalink
Improved Geth configure changes
Browse files Browse the repository at this point in the history
  • Loading branch information
remyroy committed Aug 5, 2022
1 parent 8568a8e commit f165b1a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions ethwizard/platforms/ubuntu/maintain.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,8 +937,19 @@ def config_geth_merge():
with open('/etc/systemd/system/' + geth_service_name, 'r') as service_file:
geth_service_content = service_file.read()

geth_service_content = re.sub(r'ExecStart\s*=\s*(.*)geth([^\\\n]+(\\\s+)?)+',
rf'\g<0> --authrpc.jwtsecret {LINUX_JWT_TOKEN_FILE_PATH}', geth_service_content)
result = re.search(r'ExecStart\s*=\s*(.*?)geth([^\\\n]*(\\\s+)?)*', geth_service_content)
if not result:
log.error('Cannot parse Geth service file.')
return False

exec_start = result.group(0)

# Add --authrpc.jwtsecret configuration
exec_start = re.sub(r'(\s*\\)?\s+--authrpc.jwtsecret\s*=?\s*\S+', '', exec_start)
exec_start = exec_start + f' --authrpc.jwtsecret {LINUX_JWT_TOKEN_FILE_PATH}'

geth_service_content = re.sub(r'ExecStart\s*=\s*(.*?)geth([^\\\n]*(\\\s+)?)*',
exec_start, geth_service_content)

# Write back configuration
with open('/etc/systemd/system/' + geth_service_name, 'w') as service_file:
Expand Down

0 comments on commit f165b1a

Please sign in to comment.