Skip to content

Commit 7064aee

Browse files
committed
support xxx/yyy/global
1 parent 0eb274e commit 7064aee

File tree

5 files changed

+32
-4
lines changed

5 files changed

+32
-4
lines changed

parse-config.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,34 @@ load_dir() {
3535
KEY=${KEY#"infrastructure.global."}
3636
fi
3737

38+
if [[ "$KEY" =~ infrastructure\.[^.]+\.global\..+ ]]; then
39+
# Remove 'infrastructure.' prefix
40+
TEMP=${KEY#infrastructure.}
41+
42+
# Split off the part after 'global.'
43+
PART_BEFORE_GLOBAL=${TEMP%%.global.*}
44+
PART_AFTER_GLOBAL=${TEMP#*.global.}
45+
46+
# Combine the parts
47+
KEY="${PART_BEFORE_GLOBAL}.${PART_AFTER_GLOBAL}"
48+
fi
49+
3850
# Removes the application.global prefix if it exists
3951
if [[ "$KEY" == "application.global."* ]]; then
4052
KEY=${KEY#"application.global."}
4153
fi
54+
55+
if [[ "$KEY" =~ application\.[^.]+\.global\..+ ]]; then
56+
# Remove 'application.' prefix
57+
TEMP=${KEY#application.}
58+
59+
# Split off the part after 'global.'
60+
PART_BEFORE_GLOBAL=${TEMP%%.global.*}
61+
PART_AFTER_GLOBAL=${TEMP#*.global.}
62+
63+
# Combine the parts
64+
KEY="${PART_BEFORE_GLOBAL}.${PART_AFTER_GLOBAL}"
65+
fi
4266

4367
# Removes the application.$application_name prefix if it exists
4468
if [[ "$KEY" == "application.$APPLICATION_NAME."* ]]; then
@@ -76,3 +100,5 @@ log "Loaded AWS Secret variables"
76100
log "Loading AWS Application Secret variables..."
77101
load_dir "$WORKDIR/aws-secret-application" false 0
78102
log "Loaded AWS Application Secret variables"
103+
104+
sort "$WORKDIR/application.properties" | uniq > "$WORKDIR/temp.properties" && mv "$WORKDIR/temp.properties" "$WORKDIR/application.properties"

test/expectation/.expected

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
auth_password=password
12
kerberos.cache.kerberos-authz.url=kerberos-authz.cache.dev.pleo.io
2-
sqs.sales.endpoint=https://sputnik-buckname.name.com
3-
msk.endpoint=https://msk.com
43
launch-darkly.key=secret_value
4+
msk.endpoint=https://msk.com
55
openai.key=beepboop
66
private=password
7+
sqs.sales.endpoint=https://sputnik-buckname.name.com
78
with.special.chars=@sbSZN%r!r!&9bgE%x&IC%2Bh952U%jD!o&Tww4^ztH#ds@3R44
8-
auth_password=password
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
kerberos-authz.cache.dev.pleo.io
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
secret_value

test/validate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ else
1111
echo $(diff $result $expected)
1212

1313
exit 1
14-
fi
14+
fi

0 commit comments

Comments
 (0)