Skip to content

Commit 6ccdbb7

Browse files
committed
feat: Add Dockerfile and environment variable support
- Create Dockerfile using `php:8-apache` base image - Modify config to use environment variables, retaining defaults - Use `filter_var()` for boolean environment variable handling
1 parent c7c0c97 commit 6ccdbb7

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM php:8-apache
2+
3+
# www-data user
4+
USER 33
5+
WORKDIR /var/www/html
6+
COPY LICENSE index.php README.md ./
7+

index.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<?php
22
// Configuration
33
$dashboard_config = [
4-
'network' => 'CHANGE_ME', // Supported values: BTC, LTC, or XMR
5-
'node_ip' => 'CHANGE_ME', // Usually 127.0.0.1 if ran locally
6-
'rpc_port' => 'CHANGE_ME', // Default RPC ports: BTC: 8332 | LTC: 9332 | XMR: 18081
7-
'rpc_user' => 'CHANGE_ME', // Note: not usually needed for XMR (leave blank if XMR)
8-
'rpc_pass' => 'CHANGE_ME', // Note: not usually needed for XMR (leave blank if XMR)
9-
'show_node_info' => true,
10-
'show_blockchain' => true,
11-
'show_mempool' => true,
12-
'show_mining' => true,
13-
'show_transactions' => true,
14-
'show_fees' => true,
4+
'network' => getenv('NETWORK') ?: 'CHANGE_ME', // Supported values: BTC, LTC, or XMR
5+
'node_ip' => getenv('NODE_IP') ?: 'CHANGE_ME', // Usually 127.0.0.1 if ran locally
6+
'rpc_port' => getenv('RPC_PORT') ?: 'CHANGE_ME', // Default RPC ports: BTC: 8332 | LTC: 9332 | XMR: 18081
7+
'rpc_user' => getenv('RPC_USER') ?: 'CHANGE_ME', // Note: not usually needed for XMR (leave blank if XMR)
8+
'rpc_pass' => getenv('RPC_PASS') ?: 'CHANGE_ME', // Note: not usually needed for XMR (leave blank if XMR)
9+
'show_node_info' => filter_var(getenv('SHOW_NODE_INFO') ?: 'true', FILTER_VALIDATE_BOOLEAN),
10+
'show_blockchain' => filter_var(getenv('SHOW_BLOCKCHAIN') ?: 'true', FILTER_VALIDATE_BOOLEAN),
11+
'show_mempool' => filter_var(getenv('SHOW_MEMPOOL') ?: 'true', FILTER_VALIDATE_BOOLEAN),
12+
'show_mining' => filter_var(getenv('SHOW_MINING') ?: 'true', FILTER_VALIDATE_BOOLEAN),
13+
'show_transactions' => filter_var(getenv('SHOW_TRANSACTIONS') ?: 'true', FILTER_VALIDATE_BOOLEAN),
14+
'show_fees' => filter_var(getenv('SHOW_FEES') ?: 'true', FILTER_VALIDATE_BOOLEAN),
1515
];
1616

1717
$network = strtoupper($dashboard_config['network']);
@@ -703,4 +703,4 @@ function call_rpc_cached($method, $params, $dashboard_config, $url_schema, $ttlO
703703
</center>
704704
</div>
705705
</body>
706-
</html>
706+
</html>

0 commit comments

Comments
 (0)