Skip to content

Commit

Permalink
Merge pull request #9 from aknguyen7/annieTest1
Browse files Browse the repository at this point in the history
update to get application work
  • Loading branch information
aknguyen7 authored Oct 3, 2024
2 parents 0418fd1 + 87214ef commit cc0b983
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ LABEL \
description="This image contains a sample application that displays the Java system properties and demonstrates MicroProfile Config, Health and Metrics."

COPY --chown=1001:0 src/main/liberty/config/ /config/
COPY --chown=1001:0 resources/ /output/resources/

RUN features.sh

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
import java.io.StringReader;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.InputStream;

import org.eclipse.microprofile.config.spi.ConfigSource;

public class CustomConfigSource implements ConfigSource {

String fileLocation = System.getProperty("user.dir").split("target")[0]
+ "/resources/CustomConfigSource.json";
String fileLocation = "META-INF/CustomConfigSource.json";

@Override
public int getOrdinal() {
Expand Down Expand Up @@ -83,7 +84,8 @@ public Map<String, String> getProperties() {
public String readFile(String fileName) {
String result = "";
try {
BufferedReader br = new BufferedReader(new FileReader(fileName));
InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName);
BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8"));
StringBuilder sb = new StringBuilder();
String line = br.readLine();
while (line != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"config_ordinal":550,"io_openliberty_sample_system_inMaintenance":false,"io_openliberty_sample_testConfigOverwrite":"CustomSource"}
{"config_ordinal":550,"io_openliberty_sample_system_inMaintenance":false,"io_openliberty_sample_testConfigOverwrite":"CustomSource"}

0 comments on commit cc0b983

Please sign in to comment.