File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Script Name : env_check.py
2
+ # Author : Craig Richards
3
+ # Created : 14th May 2012
4
+ # Last Modified :
5
+ # Version : 1.0
6
+
7
+ # Modifications :
8
+
9
+ # Description : This script will check to see if all of the environment variables I require are set
10
+
11
+ import os
12
+
13
+ confdir = os .getenv ("my_config" ) # Set the variable confdir from the OS environment variable
14
+ conffile = 'env_check.conf' # Set the variable conffile
15
+ conffilename = os .path .join (confdir , conffile ) # Set the variable conffilename by joining confdir and conffile together
16
+
17
+ for env_check in open (conffilename ): # Open the config file and read all the settings
18
+ env_check = env_check .strip () # Set the variable as itsself, but strip the extra text out
19
+ print '[{}]' .format (env_check ) # Format the Output to be in Square Brackets
20
+ newenv = os .getenv (env_check ) # Set the variable newenv to get the settings from the OS what is currently set for the settings out the configfile
21
+ if newenv is None : # If it doesn't exist
22
+ print env_check , 'is not set' # Print it is not set
23
+ else : # Else if it does exist
24
+ print 'Current Setting for {}={}\n ' .format (env_check , newenv ) # Print out the details
You can’t perform that action at this time.
0 commit comments