mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
feat: dev hot reload setup
This commit is contained in:
52
.air.toml
Normal file
52
.air.toml
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
root = "."
|
||||||
|
testdata_dir = "testdata"
|
||||||
|
tmp_dir = "out"
|
||||||
|
|
||||||
|
[build]
|
||||||
|
args_bin = []
|
||||||
|
bin = "./out/main"
|
||||||
|
cmd = "go build -o ./out/main ."
|
||||||
|
delay = 1000
|
||||||
|
exclude_dir = ["assets", "out", "vendor", "testdata"]
|
||||||
|
exclude_file = []
|
||||||
|
exclude_regex = ["_test.go"]
|
||||||
|
exclude_unchanged = false
|
||||||
|
follow_symlink = false
|
||||||
|
full_bin = ""
|
||||||
|
include_dir = []
|
||||||
|
include_ext = ["go", "tpl", "tmpl", "html"]
|
||||||
|
include_file = []
|
||||||
|
kill_delay = "0s"
|
||||||
|
log = "build-errors.log"
|
||||||
|
poll = false
|
||||||
|
poll_interval = 0
|
||||||
|
post_cmd = []
|
||||||
|
pre_cmd = []
|
||||||
|
rerun = false
|
||||||
|
rerun_delay = 500
|
||||||
|
send_interrupt = false
|
||||||
|
stop_on_error = false
|
||||||
|
|
||||||
|
[color]
|
||||||
|
app = ""
|
||||||
|
build = "yellow"
|
||||||
|
main = "magenta"
|
||||||
|
runner = "green"
|
||||||
|
watcher = "cyan"
|
||||||
|
|
||||||
|
[log]
|
||||||
|
main_only = false
|
||||||
|
silent = false
|
||||||
|
time = false
|
||||||
|
|
||||||
|
[misc]
|
||||||
|
clean_on_exit = false
|
||||||
|
|
||||||
|
[proxy]
|
||||||
|
app_port = 0
|
||||||
|
enabled = false
|
||||||
|
proxy_port = 0
|
||||||
|
|
||||||
|
[screen]
|
||||||
|
clear_on_rebuild = false
|
||||||
|
keep_scroll = true
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -31,3 +31,4 @@ go.work.sum
|
|||||||
# .idea/
|
# .idea/
|
||||||
# .vscode/
|
# .vscode/
|
||||||
ironmount
|
ironmount
|
||||||
|
out/
|
||||||
|
|||||||
12
Dockerfile.dev
Normal file
12
Dockerfile.dev
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
FROM golang:1.24-alpine3.21 AS builder
|
||||||
|
|
||||||
|
WORKDIR /ironmount
|
||||||
|
|
||||||
|
RUN go install github.com/air-verse/air@latest
|
||||||
|
COPY go.mod ./
|
||||||
|
|
||||||
|
RUN go mod download
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
CMD ["air", "-c", ".air.toml"]
|
||||||
@@ -1 +1,3 @@
|
|||||||
# ironmount
|
# ironmount
|
||||||
|
|
||||||
|
mutagen sync create ~/Developer/ironmount nicolas@192.168.2.220:/home/nicolas/ironmount
|
||||||
|
|||||||
@@ -4,9 +4,13 @@ services:
|
|||||||
ironmount:
|
ironmount:
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile.dev
|
||||||
container_name: ironmount
|
container_name: ironmount
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
volumes:
|
volumes:
|
||||||
|
- ./:/ironmount
|
||||||
|
|
||||||
- /run/docker/plugins:/run/docker/plugins
|
- /run/docker/plugins:/run/docker/plugins
|
||||||
- /tmp/ironmount:/tmp/ironmount
|
- /tmp/ironmount:/tmp/ironmount
|
||||||
|
environment:
|
||||||
|
- GO_ENV=development
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func Activate(w http.ResponseWriter, r *http.Request) {
|
func Activate(w http.ResponseWriter, r *http.Request) {
|
||||||
// Log the activation request
|
|
||||||
log.Printf("Received activation request: %s", r.URL.Path)
|
log.Printf("Received activation request: %s", r.URL.Path)
|
||||||
|
|
||||||
resp := map[string]any{
|
resp := map[string]any{
|
||||||
|
|||||||
@@ -3,12 +3,15 @@ package driver
|
|||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"ironmount/internal/constants"
|
"ironmount/internal/constants"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Create(w http.ResponseWriter, r *http.Request) {
|
func Create(w http.ResponseWriter, r *http.Request) {
|
||||||
|
log.Printf("Received create request: %s", r.URL.Path)
|
||||||
|
|
||||||
var req struct {
|
var req struct {
|
||||||
Name string
|
Name string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,13 @@ package driver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Mount(w http.ResponseWriter, r *http.Request) {
|
func Mount(w http.ResponseWriter, r *http.Request) {
|
||||||
|
log.Printf("Received mount request: %s", r.URL.Path)
|
||||||
|
|
||||||
var req MountRequest
|
var req MountRequest
|
||||||
err := json.NewDecoder(r.Body).Decode(&req)
|
err := json.NewDecoder(r.Body).Decode(&req)
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,13 @@ package driver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Path(w http.ResponseWriter, r *http.Request) {
|
func Path(w http.ResponseWriter, r *http.Request) {
|
||||||
|
log.Printf("Received path request: %s", r.URL.Path)
|
||||||
|
|
||||||
var req PathRequest
|
var req PathRequest
|
||||||
_ = json.NewDecoder(r.Body).Decode(&req)
|
_ = json.NewDecoder(r.Body).Decode(&req)
|
||||||
|
|
||||||
|
|||||||
@@ -2,10 +2,13 @@ package driver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Remove(w http.ResponseWriter, r *http.Request) {
|
func Remove(w http.ResponseWriter, r *http.Request) {
|
||||||
|
log.Printf("Received remove request: %s", r.URL.Path)
|
||||||
|
|
||||||
var req RemoveRequest
|
var req RemoveRequest
|
||||||
_ = json.NewDecoder(r.Body).Decode(&req)
|
_ = json.NewDecoder(r.Body).Decode(&req)
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,12 @@ package driver
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Unmount(w http.ResponseWriter, r *http.Request) {
|
func Unmount(w http.ResponseWriter, r *http.Request) {
|
||||||
|
log.Printf("Received unmount request: %s", r.URL.Path)
|
||||||
|
|
||||||
_ = json.NewEncoder(w).Encode(map[string]string{"Err": ""})
|
_ = json.NewEncoder(w).Encode(map[string]string{"Err": ""})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user