Add WebgitProperties configuration
Add configuration properties class with worktreePath and gitDirPath settings, and JGit dependency. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
package be.seeseepuff.webgit.config;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "webgit")
|
||||
@Getter
|
||||
@Setter
|
||||
public class WebgitProperties
|
||||
{
|
||||
private Path worktreePath;
|
||||
private Path gitDirPath;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package be.seeseepuff.webgit.config;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@SpringBootTest
|
||||
@TestPropertySource(properties = {
|
||||
"webgit.worktree-path=/mnt/shared/repos",
|
||||
"webgit.git-dir-path=/var/lib/webgit/git"
|
||||
})
|
||||
class WebgitPropertiesTest
|
||||
{
|
||||
@Autowired
|
||||
private WebgitProperties properties;
|
||||
|
||||
@Test
|
||||
void worktreePathIsBound()
|
||||
{
|
||||
assertEquals(Path.of("/mnt/shared/repos"), properties.getWorktreePath());
|
||||
}
|
||||
|
||||
@Test
|
||||
void gitDirPathIsBound()
|
||||
{
|
||||
assertEquals(Path.of("/var/lib/webgit/git"), properties.getGitDirPath());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user