Add DCAE MOD design tool project
[dcaegen2/platform.git] / mod / designtool / designtool-web / sh / common.sh
1 #!/bin/sh -e
2 #    Licensed to the Apache Software Foundation (ASF) under one or more
3 #    contributor license agreements.  See the NOTICE file distributed with
4 #    this work for additional information regarding copyright ownership.
5 #    The ASF licenses this file to You under the Apache License, Version 2.0
6 #    (the "License"); you may not use this file except in compliance with
7 #    the License.  You may obtain a copy of the License at
8 #
9 #       http://www.apache.org/licenses/LICENSE-2.0
10 #
11 #    Unless required by applicable law or agreed to in writing, software
12 #    distributed under the License is distributed on an "AS IS" BASIS,
13 #    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 #    See the License for the specific language governing permissions and
15 #    limitations under the License.
16
17 #
18 #    Modifications to the original nifi code for the ONAP project are made
19 #    available under the Apache License, Version 2.0
20 #
21
22 # 1 - value to search for
23 # 2 - value to replace
24 # 3 - file to perform replacement inline
25 prop_replace () {
26   target_file=${3:-${nifi_props_file}}
27   echo 'replacing target file ' ${target_file}
28   sed -i -e "s|^$1=.*$|$1=$2|"  ${target_file}
29 }
30
31 # 1 - property name
32 # 2 - property value
33 # 3 - file to perform replacement inline
34 prop_append () {
35   target_file=${3:-${nifi_props_file}}
36   echo 'appending target file ' ${target_file}
37   sed -i "$ a $1=$2"  ${target_file}
38 }
39
40 # NIFI_HOME is defined by an ENV command in the backing Dockerfile
41 export nifi_props_file=${NIFI_HOME}/conf/nifi.properties
42 export nifi_toolkit_props_file=${HOME}/.nifi-cli.nifi.properties
43 export hostname=$(hostname)