File tree Expand file tree Collapse file tree 1 file changed +29
-5
lines changed
Expand file tree Collapse file tree 1 file changed +29
-5
lines changed Original file line number Diff line number Diff line change 88# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
99# See the License for the specific language governing permissions and
1010# limitations under the License.
11+ """
12+ Loads environment variables for remote connection and file transfer.
13+
14+ Expected variables:
15+ - DEST_IP
16+ - DEST_USER
17+ - DEST_PASS
18+ - LOCAL_FILE
19+ - REMOTE_PATH
20+ """
1121
1222import os
23+ import sys
24+
25+ DEST_IP : str = os .getenv ("DEST_IP" )
26+ DEST_USER : str = os .getenv ("DEST_USER" )
27+ DEST_PASS : str = os .getenv ("DEST_PASS" )
28+ LOCAL_FILE : str = os .getenv ("LOCAL_FILE" )
29+ REMOTE_PATH : str = os .getenv ("REMOTE_PATH" )
30+
31+ # Validate required variables
32+ REQUIRED_VARS = {
33+ "DEST_IP" : DEST_IP ,
34+ "DEST_USER" : DEST_USER ,
35+ "DEST_PASS" : DEST_PASS ,
36+ "LOCAL_FILE" : LOCAL_FILE ,
37+ "REMOTE_PATH" : REMOTE_PATH ,
38+ }
1339
14- DEST_IP = os .environ ["DEST_IP" ]
15- DEST_USER = os .environ ["DEST_USER" ]
16- DEST_PASS = os .environ ["DEST_PASS" ]
17- LOCAL_FILE = os .environ ["LOCAL_FILE" ]
18- REMOTE_PATH = os .environ ["REMOTE_PATH" ]
40+ missing = [key for key , value in REQUIRED_VARS .items () if not value ]
41+ if missing :
42+ sys .exit (f"Missing required environment variables: { ', ' .join (missing )} " )
You can’t perform that action at this time.
0 commit comments