Skip to content

Commit 8661324

Browse files
committed
Improve indentation of generated nginx.conf
1 parent 13d390e commit 8661324

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed

internal/file/bindata.go

+24-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rootfs/ingress-controller/clean-nginx-conf.sh

+4-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@
2121
# 1. remove the return carrier character/s
2222
# 2. remove empty lines
2323
# 3. replace multiple empty lines
24-
sed -e 's/\r//g' | sed -e 's/^ *$/\'$'\n/g' | sed -e '/^$/{N;/^\n$/D;}'
24+
25+
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})
26+
27+
sed -e 's/\r//g' | sed -e 's/^ *$/\'$'\n/g' | sed -e '/^$/{N;/^\n$/D;}' | ${SCRIPT_ROOT}/indent.sh

rootfs/ingress-controller/indent.sh

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/awk -f
2+
3+
# Copyright 2017 The Kubernetes Authors.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# 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+
# Credits to https://evasive.ru/f29bd7ebacf24a50c582f973a55eee28.html
18+
19+
{sub(/^[ \t]+/,"");idx=0}
20+
/\{/{ctx++;idx=1}
21+
/\}/{ctx--}
22+
{id="";for(i=idx;i<ctx;i++)id=sprintf("%s%s", id, "\t");printf "%s%s\n", id, $0}

0 commit comments

Comments
 (0)