dashboard / melanie/penelope / convert to environment variables #114 rss

closed · opened on 2026-02-25T00:32:19Z by melanie
Help
checkout latest patchset:
ssh pr.pico.sh print pr-114 | git am -3
checkout any patchset in a patch request:
ssh pr.pico.sh print ps-X | git am -3
add changes to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add 114
add review to patch request:
git format-patch main --stdout | ssh pr.pico.sh pr add --review 114
accept PR:
ssh pr.pico.sh pr accept 114
close PR:
ssh pr.pico.sh pr close 114
Timeline Patchsets

Patchset ps-204

convert to environment variables

Melanie Kat
2026-02-25T00:26:38Z
bot.php
+8 -7
Back to top
+8 -7 bot.php link
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
diff --git a/bot.php b/bot.php
index 1333798..78ce627 100644
--- a/bot.php
+++ b/bot.php
@@ -3,17 +3,18 @@
 // The omg.lol generic IRC bot framework lol
 // Based on https://github.com/Hammster/php-irc-bot/tree/master
 
-// Configure your bot's details here
-$nickname = 'your-bot';
-$hostname = 'example.com';
-$password = 'correct-horse-battery-stapler';
-$server   = 'irc.example.com';
-$port     = 6697;
+// Configure your bot's details
+// with environment variables
+$nickname = $_ENV["NICKNAME"];
+$hostname = $_ENV["HOSTNAME"];
+$password = $_ENV["PASSWORD"];
+$server   = $_ENV["SERVER"];
+$port     = $_ENV["PORT"];
 
 // In order to update the bot's code while it's connected to IRC, we need a separate "functions" script.
 // This script will receive a stream of the IRC activity, and then it'll "do stuff" and send the response
 // back to *this* script. If that makes sense. I hope it does.
-$functions_script_command = '/usr/bin/php /path/to/bot_functions.php';
+$functions_script_command = 'NICKNAME=$nickname /usr/bin/php -d variables_order=EGPCS ./bot_functions.php';
 
 // Finally, you can plop a URL to an avatar image here for IRCv3 avatars, or set to 'false' to disable
 $avatar_url = false;
+1 -1 bot_functions.php link
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
diff --git a/bot_functions.php b/bot_functions.php
index 0a60dc3..9269c87 100644
--- a/bot_functions.php
+++ b/bot_functions.php
@@ -3,7 +3,7 @@
 // Penelope Bot Functions
 
 // eventually we can make the nickname be handed off from the main script, but for now, set it here too
-$nickname = 'your-bot';
+$nickname = $_ENV["NICKNAME"];
 
 // you can configure channels to join here
 $channels  = array(