-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace darkhttpd with cozystack-assets-server (#596)
fixes #602 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new custom assets server for serving static files - Replaced `darkhttpd` with a custom Go-based file server - **Improvements** - Updated base images to Alpine Linux 3.21 - Simplified container dependencies - Enhanced server configuration with command-line flags - **Infrastructure** - Rebuilt Kubernetes deployment configuration for assets service - Updated server startup parameters and container settings <!-- end of auto-generated comment: release notes by coderabbit.ai -->
- Loading branch information
Showing
3 changed files
with
40 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"log" | ||
"net/http" | ||
"path/filepath" | ||
) | ||
|
||
func main() { | ||
addr := flag.String("address", ":8123", "Address to listen on") | ||
dir := flag.String("dir", "/cozystack/assets", "Directory to serve files from") | ||
flag.Parse() | ||
|
||
absDir, err := filepath.Abs(*dir) | ||
if err != nil { | ||
log.Fatalf("Error getting absolute path for %s: %v", *dir, err) | ||
} | ||
|
||
fs := http.FileServer(http.Dir(absDir)) | ||
http.Handle("/", fs) | ||
|
||
log.Printf("Server starting on %s, serving directory %s", *addr, absDir) | ||
|
||
err = http.ListenAndServe(*addr, nil) | ||
if err != nil { | ||
log.Fatalf("Server failed to start: %v", err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters