added on local at 2026-07-01 16:01:33
| 1 | package MODS::Config; | |
| 2 | #====================================================================== | |
| 3 | # Framework-level config. Used by MODS::Template and the MODS layer. | |
| 4 | # ABForge-specific settings live in MODS::ABForge::Config — keep this | |
| 5 | # one minimal so it stays generic and reusable. | |
| 6 | #====================================================================== | |
| 7 | ||
| 8 | use strict; | |
| 9 | use warnings; | |
| 10 | ||
| 11 | use lib "/var/www/vhosts/abforge.com/httpdocs/"; | |
| 12 | ||
| 13 | sub new { | |
| 14 | my ($class) = @_; | |
| 15 | return bless({}, $class); | |
| 16 | } | |
| 17 | ||
| 18 | sub settings { | |
| 19 | my ($self, $request) = @_; | |
| 20 | ||
| 21 | # ----- Optional staging tag -------------------------------------- | |
| 22 | # If MODS/nodename.txt exists, the first line is the host name. | |
| 23 | # If the host name contains -dev- / -cc- / -rnd- a red staging | |
| 24 | # banner is shown in the corner of every page. Otherwise no tag. | |
| 25 | my $node_name = ''; | |
| 26 | if (open(my $fh, '<', "/var/www/vhosts/abforge.com/httpdocs/MODS/nodename.txt")) { | |
| 27 | my @file_data = <$fh>; | |
| 28 | close $fh; | |
| 29 | $node_name = $file_data[0] // ''; | |
| 30 | } | |
| 31 | ||
| 32 | my ($tag_name, $tag_bg_color, $tag_text_color); | |
| 33 | if ($node_name =~ /-dev-|-cc-|-rnd-|-stage-/im) { | |
| 34 | $tag_name = 'STAGING'; | |
| 35 | $tag_bg_color = '#FF1F1F'; | |
| 36 | $tag_text_color = '#FFFFFF'; | |
| 37 | } | |
| 38 | ||
| 39 | # ----- Settings -------------------------------------------------- | |
| 40 | return $tag_name if $request eq 'tag_name'; | |
| 41 | return $tag_bg_color if $request eq 'tag_bg_color'; | |
| 42 | return $tag_text_color if $request eq 'tag_text_color'; | |
| 43 | ||
| 44 | # Database name — Template.pm reads this for permission lookups. | |
| 45 | return 'abforge3dshawn' if $request eq 'database_name'; | |
| 46 | ||
| 47 | return 'https://' if $request eq 'secure_url'; | |
| 48 | return 'ABForge' if $request eq 'website_title'; | |
| 49 | return '/assets' if $request eq 'assets'; | |
| 50 | return '/var/www/vhosts/abforge.com/httpdocs/assets' if $request eq 'assets_css'; | |
| 51 | return 'https://abforge.com' if $request eq 'base_url'; | |
| 52 | return '' if $request eq 'feedback_emails'; | |
| 53 | ||
| 54 | return undef; | |
| 55 | } | |
| 56 | ||
| 57 | 1; |