1. In the container, when the environment variable is obtained for the first time, the configuration value of the production environment is obtained, or it is not obtained (set in the program, when the environment variable is not set, the default setting is the configuration value of the production environment). When the environment variable is obtained for the second time, the configuration value of the test environment is obtained.
2. Decide to print the environment variables to the log file to analyze whether the corresponding environment variables have been obtained. Edit in index.php as follows
file_put_contents(__DIR__.'/../storage/logs/theme-cdn.txt', print_r(date('Y-m-d H:i:s') . '-' . getenv('THEME_ASSET_CDN_BUCKET') . PHP_EOL, true), FILE_APPEND | LOCK_EX);
3. The contents of the final log file are as follows. as shown in Figure 1

/var/www/object/storage/logs # cat theme-cdn.txt
2023-02-23 01:47:06-object-theme-assets-test
2023-02-23 01:47:07-object-theme-assets-test
2023-02-23 01:47:07-object-theme-assets-test
2023-02-23 01:47:07-object-theme-assets-test
2023-02-23 01:47:07-object-theme-assets-test
2023-02-23 01:47:07-object-theme-assets-test
Need long-term technical maintenance or remote troubleshooting?
I am a PHP / Go backend engineer with 15+ years of experience, focused on existing system maintenance, bug fixing, performance optimization, server troubleshooting, WordPress maintenance, and small feature iterations.
If your project is facing any of the following issues, we can start with a small troubleshooting task first:
- ✅ PHP / Laravel / Yii2 legacy systems without active maintenance
- ✅ Go / Gin backend APIs that need troubleshooting or optimization
- ✅ Slow, broken, or unstable WordPress websites
- ✅ Nginx / MySQL / Redis / Linux server issues
- ✅ CDN / Cloudflare / DNS / HTTPS configuration problems
- ✅ Long-term remote technical support or part-time maintenance
More details: About Me & Collaboration
WeChat: 13980074657
Email: shuijingwanwq@gmail.com
Telegram: @shuijingwan
GitHub: https://github.com/shuijingwan

Leave a Reply