Init app
This commit is contained in:
parent
43d29f1401
commit
100547514d
9
pom.xml
9
pom.xml
@ -35,11 +35,20 @@
|
||||
|
||||
<!-- Depends -->
|
||||
<dependencies>
|
||||
<!-- Spring -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Libraries -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.32</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Tests -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
|
33
src/main/java/me/braydon/mc/RESTfulMC.java
Normal file
33
src/main/java/me/braydon/mc/RESTfulMC.java
Normal file
@ -0,0 +1,33 @@
|
||||
package me.braydon.mc;
|
||||
|
||||
import lombok.NonNull;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author Braydon
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@Slf4j(topic = "RESTfulMC")
|
||||
public final class RESTfulMC {
|
||||
@SneakyThrows
|
||||
public static void main(@NonNull String[] args) {
|
||||
File config = new File("application.yml");
|
||||
if (!config.exists()) { // Saving the default config if it doesn't exist locally
|
||||
Files.copy(Objects.requireNonNull(RESTfulMC.class.getResourceAsStream("/application.yml")), config.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
log.info("Saved the default configuration to '{}', please re-launch the application", // Log the default config being saved
|
||||
config.getAbsolutePath()
|
||||
);
|
||||
return;
|
||||
}
|
||||
log.info("Found configuration at '{}'", config.getAbsolutePath()); // Log the found config
|
||||
SpringApplication.run(RESTfulMC.class, args);
|
||||
}
|
||||
}
|
25
src/main/resources/application.yml
Normal file
25
src/main/resources/application.yml
Normal file
@ -0,0 +1,25 @@
|
||||
# Server Configuration
|
||||
server:
|
||||
address: 0.0.0.0
|
||||
port: 7500
|
||||
|
||||
# Log Configuration
|
||||
logging:
|
||||
file:
|
||||
path: "./logs"
|
||||
|
||||
# Spring Configuration
|
||||
spring:
|
||||
data:
|
||||
# Redis - This is used for caching
|
||||
redis:
|
||||
host: "127.0.0.1"
|
||||
port: 6379
|
||||
database: 0
|
||||
auth: "" # Leave blank for no auth
|
||||
|
||||
# Ignore
|
||||
application:
|
||||
name: "RESTfulMC"
|
||||
banner:
|
||||
location: "classpath:banner.txt"
|
10
src/main/resources/banner.txt
Normal file
10
src/main/resources/banner.txt
Normal file
@ -0,0 +1,10 @@
|
||||
_____ ______ _____ _______ __ _ __ __ _____
|
||||
| __ \| ____|/ ____|__ __/ _| | | \/ |/ ____|
|
||||
| |__) | |__ | (___ | | | |_ _ _| | \ / | |
|
||||
| _ /| __| \___ \ | | | _| | | | | |\/| | |
|
||||
| | \ \| |____ ____) | | | | | | |_| | | | | | |____
|
||||
|_| \_\______|_____/ |_| |_| \__,_|_|_| |_|\_____|
|
||||
|
||||
| API Version - v${application.version}
|
||||
| Spring Version - ${spring-boot.formatted-version}
|
||||
_______________________________________
|
Loading…
Reference in New Issue
Block a user