Skip to content

Commit f15d790

Browse files
authored
REQUEST_TIMEOUT Env Var (#541)
1 parent 14efd0d commit f15d790

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

safety/constants.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# -*- coding: utf-8 -*-
22
import configparser
3+
import os
34
from enum import Enum
45
from pathlib import Path
56
from typing import Optional
67

7-
88
JSON_SCHEMA_VERSION = '2.0.0'
99

1010
# TODO fix this
@@ -15,8 +15,8 @@
1515
DIR_NAME = ".safety"
1616

1717
def get_system_dir() -> Path:
18-
import sys
1918
import os
19+
import sys
2020
raw_dir = os.getenv("SAFETY_SYSTEM_CONFIG_PATH")
2121
app_data = os.environ.get('ALLUSERSPROFILE', None)
2222

@@ -98,7 +98,8 @@ def get_config_setting(name: str) -> Optional[str]:
9898
DATA_API_BASE_URL
9999
]
100100

101-
REQUEST_TIMEOUT = 30
101+
# Fetch the REQUEST_TIMEOUT from the environment variable, defaulting to 30 if not set
102+
REQUEST_TIMEOUT = int(os.getenv("SAFETY_REQUEST_TIMEOUT", 30))
102103

103104
# Colors
104105
YELLOW = 'yellow'
@@ -122,19 +123,19 @@ def get_config_setting(name: str) -> Optional[str]:
122123
MSG_NO_AUTHD_CICD_PROD_STG_ORG = \
123124
f"""
124125
Login to get your API key
125-
126+
126127
To log in: [link]{{LOGIN_URL}}[/link]
127-
128+
128129
Read more at: [link]{DOCS_API_KEY_URL}[/link]
129130
"""
130131

131132
MSG_NO_AUTHD_NOTE_CICD_PROD_STG_TPL = \
132133
f"""
133134
Login or register for a free account to get your API key
134-
135+
135136
To log in: [link]{{LOGIN_URL}}[/link]
136137
To register: [link]{{SIGNUP_URL}}[/link]
137-
138+
138139
Read more at: [link]{DOCS_API_KEY_URL}[/link]
139140
"""
140141

0 commit comments

Comments
 (0)