Compare commits

..

18 Commits

11 changed files with 102 additions and 72 deletions
-5
View File
@@ -1,5 +0,0 @@
# HTTP Settings
PORT=8080
# App Settings
STORAGE_PATH=files
+33 -10
View File
@@ -1,14 +1,21 @@
# ---> Go
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
### Project Specific
# Files
.env
.env.bak
.env.backup
.env.production
.forgent.json
.container_id
.session_id
*.log
docker-compose.override.yml
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
drogobox
# Test binary, built with `go test -c`
@@ -17,13 +24,29 @@ drogobox
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
# vendor/
# Go workspace file
go.work
go.work.sum
# env file
.env
# Directories
### Editor Specific
# Files
/*.sublime-project
/*.sublime-workspace
# Directories
/.fleet
/.idea
/.nova
/.vscode
/.zed
### System Specific
# Files
.DS_Store
Thumbs.db
# Directories
__MACOSX
+3 -4
View File
@@ -9,16 +9,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- v1.1 German Translation
-
### Changed
- Use frontmatter title & description in each language version template
-
### Removed
- Trademark sign previously shown after the project description in version
0.3.0
-
## [0.0.0] - 2000-01-01
+3
View File
@@ -9,3 +9,6 @@ vet: fmt
build: vet
go build -o drogobox internal/app/main.go
test:
go test ./tests/...
View File
View File
+2 -4
View File
@@ -1,5 +1,3 @@
module drogobox.com/drogobox
module drogobox.com/drogobox-server
go 1.25.9
require github.com/joho/godotenv v1.5.1 // indirect
go 1.26.3
-2
View File
@@ -1,2 +0,0 @@
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
-47
View File
@@ -1,47 +0,0 @@
package main
import (
"fmt"
"log"
"os"
"github.com/joho/godotenv"
)
func resolveFileStorePath(file_store_path string) {
err := os.MkdirAll(file_store_path, os.ModePerm)
if err != nil {
log.Fatal(err)
}
}
func readFilesFromFileStorePath(file_store_path string) {
files, err := os.ReadDir(file_store_path)
if err != nil {
log.Fatal(err)
}
for _, file := range files {
if !file.IsDir() {
fmt.Println(file.Name())
}
}
}
func main() {
err := godotenv.Load()
if err != nil {
log.Fatal("Error loading .env file")
}
port := os.Getenv("PORT")
file_store_path := os.Getenv("STORAGE_PATH")
resolveFileStorePath(file_store_path)
fmt.Printf("in the future I will listen on port: %s\n", port)
fmt.Printf("Reading files from: %s\n", file_store_path)
readFilesFromFileStorePath(file_store_path)
}
+38
View File
@@ -0,0 +1,38 @@
package storage
import (
"io"
"os"
)
type LocalStorage struct {
BaseDir string
}
func (s *LocalStorage) UploadFile(dirPath string, filename string, data io.Reader) error {
//
}
func (s *LocalStorage) ListFiles(dirPath string) ([]FileNode, error) {
//
}
func (s *LocalStorage) ReadFile(filePath string) (*os.File, error) {
//
}
func (s *LocalStorage) WriteFile(dirPath string, filename string, data io.Reader) (int, error) {
// this is explicitly for writing text files that aren't being uploaded
}
func (s *LocalStorage) DeleteFile(filePath string) error {
//
}
func (s *LocalStorage) DeleteDirectory(dirPath string) error {
//
}
func (s *LocalStorage) DeleteDirectoryRecursive(dirPath string) error {
//
}
+23
View File
@@ -0,0 +1,23 @@
package storage
import (
"io"
"os"
)
type Storage interface {
UploadFile(dirPath string, filename string, data io.Reader) error
ListFiles(dirPath string) ([]FileNode, error)
ReadFile(filePath string) (*os.File, error)
WriteFile(dirPath string, filename string, data io.Reader) (int, error)
DeleteFile(filePath string) error
DeleteDirectory(dirPath string) error
DeleteDirectoryRecursive(dirPath string) error
}
type FileNode struct {
RelativeBasePath string
FileName string
IsDirectory bool
FileSize uint64
}