@@ -6,15 +6,15 @@ subscription_id=$1
6
6
resource_group_name=$2
7
7
nginx_deployment_name=$3
8
8
config_dir_path=$4
9
- root_config_file_name =$5
9
+ root_config_file =$5
10
10
transformed_config_dir_path=${6:- ' ' }
11
11
12
12
# Validation and preprocessing
13
13
14
14
if [[ " $config_dir_path " = /* ]]
15
15
then
16
16
echo " The NGINX configuration directory path in the repository '$config_dir_path ' must be a relative path."
17
- exit 2
17
+ exit 1
18
18
elif [[ ! " $config_dir_path " = * / ]]
19
19
then
20
20
echo " The NGINX configuration directory path '$config_dir_path ' does not end with '/'. Appending a trailing '/'."
26
26
echo " The NGINX configuration directory '$config_dir_path ' was found."
27
27
else
28
28
echo " The NGINX configuration directory '$config_dir_path ' does not exist."
29
- exit 2
29
+ exit 1
30
30
fi
31
31
32
- root_config_file_path=" $config_dir_path$root_config_file_name "
33
- if [[ -f " $root_config_file_path " ]]
32
+ if [[ " $root_config_file " = /* ]]
34
33
then
35
- echo " The root NGINX configuration file '$root_config_file_path ' was found."
34
+ echo " The NGINX configuration root file path '$root_config_file ' must be a relative path to the NGINX configuration directory."
35
+ exit 1
36
+ fi
37
+
38
+ root_config_file=$( echo $root_config_file | sed ' s:^\.\/*::' )
39
+
40
+ root_config_file_repo_path=" $config_dir_path$root_config_file "
41
+ if [[ -f " $root_config_file_repo_path " ]]
42
+ then
43
+ echo " The root NGINX configuration file '$root_config_file_repo_path ' was found."
36
44
else
37
- echo " The root NGINX configuration file '$root_config_file_path ' does not exist."
38
- exit 2
45
+ echo " The root NGINX configuration file '$root_config_file_repo_path ' does not exist."
46
+ exit 1
39
47
fi
40
48
41
49
if [[ -n " $transformed_config_dir_path " ]]
42
50
then
43
51
if [[ ! " $transformed_config_dir_path " = /* ]]
44
52
then
45
53
echo " The specified transformed NGINX configuration directory path '$transformed_config_dir_path ' must be an absolute path that starts with '/'."
46
- exit 2
54
+ exit 1
47
55
elif [[ ! " $transformed_config_dir_path " = * / ]]
48
56
then
49
57
echo " The specified transformed NGINX configuration directory path '$transformed_config_dir_path ' does not end with '/'. Appending a trailing '/'."
50
58
transformed_config_dir_path=" $transformed_config_dir_path /"
51
59
fi
52
60
fi
53
61
54
- transformed_root_config_file_path=" $transformed_config_dir_path$root_config_file_name "
62
+ transformed_root_config_file_path=" $transformed_config_dir_path$root_config_file "
55
63
echo " The transformed root NGINX configuration file path is '$transformed_root_config_file_path '."
56
64
57
65
# Create a NGINX configuration tarball.
0 commit comments