Merge 374c48f66c6769277ca67d9f81479da4ab865c40 into 3dd3e7559d99fcd263669e048851b9aa9ceb43c2

This commit is contained in:
acg5159 2025-06-06 20:19:00 +05:30 committed by GitHub
commit 6a2ddaa9c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 21 additions and 2 deletions

View File

@ -38,7 +38,12 @@ RUN dpkg -i /libgl1-mesa-dri.deb \
# Create flaresolverr user # Create flaresolverr user
&& useradd --home-dir /app --shell /bin/sh flaresolverr \ && useradd --home-dir /app --shell /bin/sh flaresolverr \
&& mv /usr/bin/chromedriver chromedriver \ && mv /usr/bin/chromedriver chromedriver \
&& chown -R flaresolverr:flaresolverr . && chown -R flaresolverr:flaresolverr . \
# Create config dir
&& mkdir /config \
&& chown flaresolverr:flaresolverr /config
VOLUME /config
# Install Python dependencies # Install Python dependencies
COPY requirements.txt . COPY requirements.txt .

View File

@ -264,6 +264,7 @@ This is the same as `request.get` but it takes one more param:
| Name | Default | Notes | | Name | Default | Notes |
|--------------------|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------| |--------------------|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| LOG_LEVEL | info | Verbosity of the logging. Use `LOG_LEVEL=debug` for more information. | | LOG_LEVEL | info | Verbosity of the logging. Use `LOG_LEVEL=debug` for more information. |
| LOG_FILE | none | Capture log to file. |
| LOG_HTML | false | Only for debugging. If `true` all HTML that passes through the proxy will be logged to the console in `debug` level. | | LOG_HTML | false | Only for debugging. If `true` all HTML that passes through the proxy will be logged to the console in `debug` level. |
| CAPTCHA_SOLVER | none | Captcha solving method. It is used when a captcha is encountered. See the Captcha Solvers section. | | CAPTCHA_SOLVER | none | Captcha solving method. It is used when a captcha is encountered. See the Captcha Solvers section. |
| TZ | UTC | Timezone used in the logs and the web browser. Example: `TZ=Europe/London`. | | TZ | UTC | Timezone used in the logs and the web browser. Example: `TZ=Europe/London`. |

View File

@ -7,9 +7,12 @@ services:
container_name: flaresolverr container_name: flaresolverr
environment: environment:
- LOG_LEVEL=${LOG_LEVEL:-info} - LOG_LEVEL=${LOG_LEVEL:-info}
- LOG_FILE=flaresolver.log
- LOG_HTML=${LOG_HTML:-false} - LOG_HTML=${LOG_HTML:-false}
- CAPTCHA_SOLVER=${CAPTCHA_SOLVER:-none} - CAPTCHA_SOLVER=${CAPTCHA_SOLVER:-none}
- TZ=Europe/London - TZ=Europe/London
ports: ports:
- "${PORT:-8191}:8191" - "${PORT:-8191}:8191"
volumes:
- /var/lib/flaresolver:/config
restart: unless-stopped restart: unless-stopped

View File

@ -76,6 +76,7 @@ if __name__ == "__main__":
# validate configuration # validate configuration
log_level = os.environ.get('LOG_LEVEL', 'info').upper() log_level = os.environ.get('LOG_LEVEL', 'info').upper()
log_file = os.environ.get('LOG_FILE', None)
log_html = utils.get_config_log_html() log_html = utils.get_config_log_html()
headless = utils.get_config_headless() headless = utils.get_config_headless()
server_host = os.environ.get('HOST', '0.0.0.0') server_host = os.environ.get('HOST', '0.0.0.0')
@ -93,6 +94,15 @@ if __name__ == "__main__":
logging.StreamHandler(sys.stdout) logging.StreamHandler(sys.stdout)
] ]
) )
if log_file:
if not log_file.startswith("/config"):
log_file = "/config/" + log_file
log_file = os.path.realpath(log_file)
log_path = os.path.dirname(log_file)
os.makedirs(log_path, exist_ok=True)
logging.getLogger().addHandler(logging.FileHandler(log_file))
# disable warning traces from urllib3 # disable warning traces from urllib3
logging.getLogger('urllib3').setLevel(logging.ERROR) logging.getLogger('urllib3').setLevel(logging.ERROR)
logging.getLogger('selenium.webdriver.remote.remote_connection').setLevel(logging.WARNING) logging.getLogger('selenium.webdriver.remote.remote_connection').setLevel(logging.WARNING)