Skip to content

Commit

Permalink
Server port configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
everoddandeven committed Dec 23, 2024
1 parent a70bb0b commit 5a3b850
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
9 changes: 5 additions & 4 deletions moneroecwid.conf
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# Configuration example
port=8080
db-host=localhost
db-port=3306
db-username=monero_ecwid
db-password=devpassword
required-confirmations=1
client-secret=Pe087Q6jr0CgwI96R2ZTuUMWfUAHQjMq
# wallet-address=9xjCAvNQaYYDLc5UsxQPZtP8nNDUJnuhiacmMaE3zzTBetYcLusyCtD5kuQNNGo3TVCEUFKjd7yjeE3rCjPahy3RQGa39aJ
# wallet-view-key=9ce15a203d7e31aa930e55e4bf18e65509fb73ba316528182b77b079bb997b0d
wallet-address=9xjCAvNQaYYDLc5UsxQPZtP8nNDUJnuhiacmMaE3zzTBetYcLusyCtD5kuQNNGo3TVCEUFKjd7yjeE3rCjPahy3RQGa39aJ
wallet-view-key=9ce15a203d7e31aa930e55e4bf18e65509fb73ba316528182b77b079bb997b0d
wallet-server-uri=http://node2.monerodevs.org:28089
wallet-password=supersecretpassword123
wallet-net-type=testnet
mail-host=
mail-port=
mail-host=smtp.mailgun.org
mail-port=587
mail-username=
mail-password=
20 changes: 20 additions & 0 deletions src/main/java/monero/ecwid/server/config/CustomPortConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package monero.ecwid.server.config;

import org.springframework.boot.web.server.ConfigurableWebServerFactory;
import org.springframework.boot.web.server.WebServerFactoryCustomizer;
import org.springframework.stereotype.Component;

@Component
public class CustomPortConfig implements WebServerFactoryCustomizer<ConfigurableWebServerFactory> {

private final ServerConfig serverConfig = ServerConfig.getServerConfig();

public CustomPortConfig() {
}

@Override
public void customize(ConfigurableWebServerFactory factory) {
factory.setPort(serverConfig.port);
System.out.println("Server configurato per avviarsi sulla porta: " + serverConfig.port);
}
}
1 change: 1 addition & 0 deletions src/main/java/monero/ecwid/server/config/ServerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public class ServerConfig {

private static ServerConfig config = null;

public Integer port = 8080;
public String dbHost = "localhost";
public Integer dbPort = 3306;
public String dbUsername = "monero_ecwid";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public static ServerConfig read(String configFilePath) throws IOException {
String mailPort = rawConfig.getOrDefault("mail-port", "");
String mailUsername = rawConfig.getOrDefault("mail-username", "");
String mailPassword = rawConfig.getOrDefault("mail-password", "");
String serverPort = rawConfig.getOrDefault("port", "8080");

Integer port = Integer.valueOf(dbPort);
Long confirmations = Long.valueOf(reqConfirmations);
Expand All @@ -60,14 +61,16 @@ public static ServerConfig read(String configFilePath) throws IOException {
config.walletViewKey = walletViewKey;
config.walletPassword = walletPassword;
config.walletNetType = walletNetType;
config.walletServerUri = walletServerUri;

config.clientSecret = clientSecret;

config.mailHost = mailHost;
config.mailPort = Integer.valueOf(mailPort);
config.mailUsername = mailUsername;
config.mailPassword = mailPassword;

config.walletServerUri = walletServerUri;
config.port = Integer.valueOf(serverPort);

return config;
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
server.port=80
spring.application.name=moneroecwid
spring.datasource.url=jdbc:mysql://localhost:3306/monero_ecwid
spring.datasource.username=monero_ecwid
Expand Down

0 comments on commit 5a3b850

Please sign in to comment.