Skip to content

Commit ffc20fa

Browse files
committed
update github workflow yaml configuration and secrets
1 parent 8e90d87 commit ffc20fa

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

.github/workflows/tests.yaml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,22 +29,15 @@ jobs:
2929
java-version: ${{ matrix.java-version }}
3030
distribution: "adopt"
3131
cache: "gradle"
32-
32+
3333
- name: Replace secrets in application.properties
3434
run: |
35-
# Get the secret values and escape special characters
36-
escaped_conn_str=$(printf '%s\n' "${{ vars.DB_CONN_STR }}" | sed -e 's/[]\/$*.^[]/\\&/g')
37-
escaped_username=$(printf '%s\n' "${{ vars.DB_USERNAME }}" | sed -e 's/[]\/$*.^[]/\\&/g')
38-
escaped_secret_value=$(printf '%s\n' "${{ secrets.DB_PASSWORD }}" | sed -e 's/[]\/$*.^[]/\\&/g')
39-
40-
# Replace placeholders in application.properties
41-
sed -i "s/DB_CONN_STR/${escaped_conn_str}/g" ./src/main/resources/application.properties
42-
sed -i "s/DB_USERNAME/${escaped_username}/g" ./src/main/resources/application.properties
43-
sed -i "s/DB_PASSWORD/${escaped_secret_value}/g" ./src/main/resources/application.properties
44-
45-
# Print the updated file for verification
46-
cat ./src/main/resources/application.properties
47-
shell: /usr/bin/bash -e {0}
35+
sed -i "s#DB_CONN_STR#${{ vars.DB_CONN_STR }}#g" src/main/resources/application.properties
36+
sed -i "s#DB_USER#${{ vars.DB_USERNAME }}#g" src/main/resources/application.properties
37+
sed -i "s#DB_PASS#${{ secrets.DB_PASSWORD }}#g" src/main/resources/application.properties
38+
39+
# Print the updated file for verification
40+
cat ./src/main/resources/application.properties
4841
4942
- name: Run Gradle Tests
5043
id: run
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
server.use-forward-headers=true
22
server.forward-headers-strategy=framework
3-
spring.couchbase.bootstrap-hosts=${DB_CONN_STR}
3+
spring.couchbase.bootstrap-hosts=DB_CONN_STR
44
spring.couchbase.bucket.name=travel-sample
5-
spring.couchbase.bucket.user=${DB_USERNAME}
6-
spring.couchbase.bucket.password=${DB_PASSWORD}
5+
spring.couchbase.bucket.user=DB_USERNAME
6+
spring.couchbase.bucket.password=DB_PASSWORD
77
spring.couchbase.scope.name=inventory
8-
spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER
9-
8+
spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER

0 commit comments

Comments
 (0)