From 244aea41cc2531e7c6c49a1ab6c26cb4c464f732 Mon Sep 17 00:00:00 2001 From: Sawyer Date: Tue, 5 Aug 2025 18:47:06 -0500 Subject: [PATCH] feat(config): allow configuration with environment variables --- config.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/config.py b/config.py index ea28e5e..2ad821c 100644 --- a/config.py +++ b/config.py @@ -1,3 +1,4 @@ +import os import argparse from dataclasses import dataclass @@ -24,7 +25,7 @@ def get_configs(): help="Port the proxy runs on.", required=False, type=int, - default=32323 + default=os.getenv("PROXY_PORT", 32323) ) parser.add_argument( @@ -32,7 +33,7 @@ def get_configs(): help="Host the proxy to runs on.", required=False, type=str, - default="0.0.0.0" + default=os.getenv("PROXY_HOST", "0.0.0.0") ) parser.add_argument( @@ -40,7 +41,7 @@ def get_configs(): help="Seconds to wait before returning content.", required=False, type=float, - default=10 + default=os.getenv("SCRAPER_WAIT_TIME", 10) ) parser.add_argument( @@ -48,7 +49,7 @@ def get_configs(): help="Whether or not to run Chrome headless.", required=False, type=bool, - default=True + default=os.getenv("SCRAPER_HEADLESS", True) ) parser.add_argument( @@ -56,7 +57,7 @@ def get_configs(): help="Chrome user agent. Changing with the current ChromeDriver version recommended.", required=False, type=str, - default="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36" + default=os.getenv("SCRAPER_USER_AGENT", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36") ) args = parser.parse_args()