2 # Copyright 2020 Huawei Technologies Co., Ltd.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # Validates if ip is valid
27 # validates whether file exist
28 validate_file_exists() {
32 validate_ip "$LISTEN_IP"
34 if [ ! "$valid_listen_ip" -eq "0" ]; then
35 echo "invalid ip address for listen ip"
39 if [ ! -z "$SERVER_NAME" ]; then
40 validate_name "$SERVER_NAME"
42 if [ ! "$valid_name" -eq "0" ]; then
43 echo "invalid ssl server name"
48 # ssl parameters validation
49 validate_file_exists "/usr/app/ssl/server_tls.crt"
50 valid_ssl_server_cert="$?"
51 if [ ! "$valid_ssl_server_cert" -eq "0" ]; then
52 echo "invalid ssl server certificate"
56 # ssl parameters validation
57 validate_file_exists "/usr/app/ssl/server_tls.key"
58 valid_ssl_server_key="$?"
59 if [ ! "$valid_ssl_server_key" -eq "0" ]; then
60 echo "invalid ssl server key"
64 # ssl parameters validation
65 validate_file_exists "/usr/app/ssl/ca.crt"
67 if [ ! "$valid_ssl_ca_crt" -eq "0" ]; then
68 echo "invalid ssl ca cert"
72 echo "Running Monitoring Service"