From 34cccecba54194bc9168be7767af7c71ea0b2850 Mon Sep 17 00:00:00 2001 From: XieChengzhi Date: Mon, 9 Dec 2024 19:55:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E9=85=8D=E7=BD=AE=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- openeuler/src/main/java/App.java | 8 +++--- openeuler/src/main/java/ImportConfig.java | 30 ----------------------- 2 files changed, 4 insertions(+), 34 deletions(-) delete mode 100644 openeuler/src/main/java/ImportConfig.java diff --git a/openeuler/src/main/java/App.java b/openeuler/src/main/java/App.java index 83b35bb..e9ce3d0 100644 --- a/openeuler/src/main/java/App.java +++ b/openeuler/src/main/java/App.java @@ -18,11 +18,11 @@ public class App { private static final String MAPPING_PATH = System.getenv("MAPPING_PATH"); private static final String INDEX_PREFIX = "openeuler_articles"; + private static final String ETHERPAD_URL = System.getenv("ETHERPAD_URL"); + private static final String ETHERPAD_KEY = System.getenv("ETHERPAD_KEY"); private static final Logger logger = LoggerFactory.getLogger(App.class); - private static final ImportConfig importConfig = new ImportConfig(); - public static void main(String[] args) { try { PublicClient.CreateClientFormConfig(APPLICATION_PATH); @@ -75,8 +75,8 @@ public static void sigData() throws Exception { } public static void etherpadData(){ - String url = importConfig.getUrl(); - String apiKey = importConfig.getApiKey(); + String url = ETHERPAD_URL; + String apiKey = ETHERPAD_KEY; EPLiteClient client = new EPLiteClient(url, apiKey); Map result = client.listAllPads(); diff --git a/openeuler/src/main/java/ImportConfig.java b/openeuler/src/main/java/ImportConfig.java deleted file mode 100644 index 80e3a8f..0000000 --- a/openeuler/src/main/java/ImportConfig.java +++ /dev/null @@ -1,30 +0,0 @@ -import java.io.InputStream; -import java.util.Properties; - -public class ImportConfig { - private String url; - private String apiKey; - - public ImportConfig() { - try (InputStream input = getClass().getClassLoader().getResourceAsStream("application.properties")) { - if (input == null) { - System.out.println("unable to find related config"); - return; - } - Properties prop = new Properties(); - prop.load(input); - this.url = prop.getProperty("url"); - this.apiKey = prop.getProperty("apiKey"); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - - public String getUrl() { - return url; - } - - public String getApiKey() { - return apiKey; - } -}