From cf6e536aca65289d938f7ad4b8e66fef54c0be60 Mon Sep 17 00:00:00 2001 From: Yvan Date: Fri, 24 Jan 2025 00:38:26 +0000 Subject: [PATCH] works to the point of serving a hard-coded user via HTTPS (needs cert set up) --- .../activitypubbot/APProperties.java | 37 +++++++++++++++++++ .../activitypubbot/APPropertiesTests.java | 17 +++++++++ 2 files changed, 54 insertions(+) create mode 100644 Java/Spring/activitypubbot/src/main/java/dev/activitypub/activitypubbot/APProperties.java create mode 100644 Java/Spring/activitypubbot/src/test/java/dev/activitypub/activitypubbot/APPropertiesTests.java diff --git a/Java/Spring/activitypubbot/src/main/java/dev/activitypub/activitypubbot/APProperties.java b/Java/Spring/activitypubbot/src/main/java/dev/activitypub/activitypubbot/APProperties.java new file mode 100644 index 0000000..4951179 --- /dev/null +++ b/Java/Spring/activitypubbot/src/main/java/dev/activitypub/activitypubbot/APProperties.java @@ -0,0 +1,37 @@ +package dev.activitypub.activitypubbot; + +import org.springframework.context.annotation.Configuration; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * Object bound to "ap" prefix in {@link org.springframework.core.env.Environment}. + * + * @author Yvan Seth + */ +@Configuration +@ConfigurationProperties(prefix = "ap") +public class APProperties { + + /** + * Key File Path + */ + private String keyFilePath = "keyfile.pem"; + + /** + * Server domain + */ + private String serverDomain = "activitypub.bot"; + + public String getKeyFilePath() { + return keyFilePath; + } + public void setKeyFilePath(String keyFilePath) { + this.keyFilePath = keyFilePath; + } + public String getServerDomain() { + return serverDomain; + } + public void setServerDomain(String serverDomain) { + this.serverDomain = serverDomain; + } +} diff --git a/Java/Spring/activitypubbot/src/test/java/dev/activitypub/activitypubbot/APPropertiesTests.java b/Java/Spring/activitypubbot/src/test/java/dev/activitypub/activitypubbot/APPropertiesTests.java new file mode 100644 index 0000000..d1ea29c --- /dev/null +++ b/Java/Spring/activitypubbot/src/test/java/dev/activitypub/activitypubbot/APPropertiesTests.java @@ -0,0 +1,17 @@ +package dev.activitypub.activitypubbot; + +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +@SpringBootTest +public class APPropertiesTests { + + @Test + public void testConfig() throws Exception { + /*mvc.perform(MockMvcRequestBuilders.get("/").accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().string(equalTo("Parsnip!"))); + */ + } +} +