Compare commits

..

No commits in common. "0d8583e3953675019c8861d0d4f02a4c31e46ac0" and "fb24f44e22aef1530d08f5d2c9408a8ece17ecc7" have entirely different histories.

13 changed files with 46 additions and 59 deletions

View File

@ -3,7 +3,7 @@ FROM golang:alpine as roadsign-server
WORKDIR /source WORKDIR /source
COPY . . COPY . .
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -buildvcs -o /dist ./pkg/cmd/server/main.go RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /dist ./pkg/cmd/server/main.go
# Runtime # Runtime
FROM golang:alpine FROM golang:alpine

View File

@ -59,8 +59,7 @@ After that, you can manage your roadsign instance with RoadSign CLI aka. RDS CLI
To install it, run this command. (Make sure you have golang toolchain on your computer) To install it, run this command. (Make sure you have golang toolchain on your computer)
```shell ```shell
go install -buildvcs code.smartsheep.studio/goatworks/roadsign/pkg/cmd/rds@latest go install code.smartsheep.studio/goatworks/roadsign/pkg/cmd/rds@latest
# Tips: Add `buildvsc` flag to provide more detail compatibility check.
``` ```
## Usage ## Usage
@ -75,7 +74,7 @@ rds cli with this command.
```shell ```shell
rds connect <id> <url> <password> rds connect <id> <url> <password>
# ID will allow you find this server in after commands. # ID will allow you find this server in after commands.
# URL is to your roadsign server sideload api. # URL is to your roadsign server administration api.
# Password is your roadsign server credential. # Password is your roadsign server credential.
# ====================================================================== # ======================================================================
# !WARNING! All these things will storage in your $HOME/.roadsignrc.yaml # !WARNING! All these things will storage in your $HOME/.roadsignrc.yaml

View File

@ -1,4 +1,4 @@
package sideload package administration
import ( import (
roadsign "code.smartsheep.studio/goatworks/roadsign/pkg" roadsign "code.smartsheep.studio/goatworks/roadsign/pkg"

View File

@ -1,4 +1,4 @@
package sideload package administration
import ( import (
"context" "context"

View File

@ -1,4 +1,4 @@
package sideload package administration
import ( import (
"fmt" "fmt"
@ -11,21 +11,21 @@ import (
"github.com/spf13/viper" "github.com/spf13/viper"
) )
func InitSideload() *fiber.App { func InitAdministration() *fiber.App {
app := fiber.New(fiber.Config{ app := fiber.New(fiber.Config{
AppName: "RoadSign Sideload", AppName: "RoadSign Administration",
ServerHeader: fmt.Sprintf("RoadSign Sideload v%s", roadsign.AppVersion), ServerHeader: fmt.Sprintf("RoadSign Administration v%s", roadsign.AppVersion),
DisableStartupMessage: true, DisableStartupMessage: true,
EnableIPValidation: true, EnableIPValidation: true,
EnablePrintRoutes: viper.GetBool("debug.print_routes"), EnablePrintRoutes: viper.GetBool("debug.print_routes"),
TrustedProxies: viper.GetStringSlice("security.sideload_trusted_proxies"), TrustedProxies: viper.GetStringSlice("security.administration_trusted_proxies"),
BodyLimit: viper.GetInt("hypertext.limitation.max_body_size"), BodyLimit: viper.GetInt("hypertext.limitation.max_body_size"),
}) })
if viper.GetBool("performance.request_logging") { if viper.GetBool("performance.request_logging") {
app.Use(logger.New(logger.Config{ app.Use(logger.New(logger.Config{
Output: log.Logger, Output: log.Logger,
Format: "[Sideload] [${time}] ${status} - ${latency} ${method} ${path}\n", Format: "[Administration] [${time}] ${status} - ${latency} ${method} ${path}\n",
})) }))
} }

View File

@ -1,4 +1,4 @@
package sideload package administration
import ( import (
"fmt" "fmt"

View File

@ -7,8 +7,8 @@ import (
"syscall" "syscall"
roadsign "code.smartsheep.studio/goatworks/roadsign/pkg" roadsign "code.smartsheep.studio/goatworks/roadsign/pkg"
"code.smartsheep.studio/goatworks/roadsign/pkg/administration"
"code.smartsheep.studio/goatworks/roadsign/pkg/hypertext" "code.smartsheep.studio/goatworks/roadsign/pkg/hypertext"
"code.smartsheep.studio/goatworks/roadsign/pkg/sideload"
"code.smartsheep.studio/goatworks/roadsign/pkg/sign" "code.smartsheep.studio/goatworks/roadsign/pkg/sign"
"github.com/google/uuid" "github.com/google/uuid"
"github.com/rs/zerolog" "github.com/rs/zerolog"
@ -65,13 +65,13 @@ func main() {
viper.GetString("hypertext.certificate.key"), viper.GetString("hypertext.certificate.key"),
) )
// Init sideload server // Init administration server
hypertext.RunServer( hypertext.RunServer(
sideload.InitSideload(), administration.InitAdministration(),
viper.GetStringSlice("hypertext.sideload_ports"), viper.GetStringSlice("hypertext.administration_ports"),
viper.GetStringSlice("hypertext.sideload_secured_ports"), viper.GetStringSlice("hypertext.administration_secured_ports"),
viper.GetString("hypertext.certificate.sideload_pem"), viper.GetString("hypertext.certificate.administration_pem"),
viper.GetString("hypertext.certificate.sideload_key"), viper.GetString("hypertext.certificate.administration_key"),
) )
log.Info().Msgf("RoadSign v%s is started...", roadsign.AppVersion) log.Info().Msgf("RoadSign v%s is started...", roadsign.AppVersion)

View File

@ -1,17 +1,5 @@
package roadsign package roadsign
import ( const (
"runtime/debug" AppVersion = "1.2.1"
) )
func init() {
if info, ok := debug.ReadBuildInfo(); ok {
for _, setting := range info.Settings {
if setting.Key == "vcs.revision" {
AppVersion += "#" + setting.Value
}
}
}
}
var AppVersion = "1.2.1"

View File

@ -1,12 +1,12 @@
debug: debug:
print_routes: true print_routes: true
hypertext: hypertext:
sideload_ports: administration_ports:
- :81 - :81
sideload_secured_ports: [] administration_secured_ports: []
certificate: certificate:
sideload_key: ./cert.key administration_key: ./cert.key
sideload_pem: ./cert.pem administration_pem: ./cert.pem
key: ./cert.key key: ./cert.key
pem: ./cert.pem pem: ./cert.pem
limitation: limitation:
@ -22,6 +22,6 @@ performance:
network_timeout: 3000 network_timeout: 3000
prefork: false prefork: false
security: security:
sideload_trusted_proxies: administration_trusted_proxies:
- localhost - localhost
credential: e81f43f32d934271af6322e5376f5f59 credential: e81f43f32d934271af6322e5376f5f59

View File

@ -1,11 +1,11 @@
debug: debug:
print_routes: false print_routes: false
hypertext: hypertext:
sideload_ports: [":81"] administration_ports: [":81"]
sideload_secured_ports: [] administration_secured_ports: []
certificate: certificate:
sideload_key: ./cert.key administration_key: ./cert.key
sideload_pem: ./cert.pem administration_pem: ./cert.pem
key: ./cert.key key: ./cert.key
pem: ./cert.pem pem: ./cert.pem
limitation: limitation:
@ -21,6 +21,6 @@ performance:
network_timeout: 3000 network_timeout: 3000
prefork: false prefork: false
security: security:
sideload_trusted_proxies: administration_trusted_proxies:
- localhost - localhost
credential: e81f43f32d934271af6322e5376f5f59 credential: e81f43f32d934271af6322e5376f5f59

View File

@ -1,11 +1,11 @@
debug: debug:
print_routes: false print_routes: false
hypertext: hypertext:
sideload_ports: [":81"] administration_ports: [":81"]
sideload_secured_ports: [] administration_secured_ports: []
certificate: certificate:
sideload_key: ./cert.key administration_key: ./cert.key
sideload_pem: ./cert.pem administration_pem: ./cert.pem
key: ./cert.key key: ./cert.key
pem: ./cert.pem pem: ./cert.pem
limitation: limitation:
@ -21,6 +21,6 @@ performance:
network_timeout: 3000 network_timeout: 3000
prefork: false prefork: false
security: security:
sideload_trusted_proxies: administration_trusted_proxies:
- localhost - localhost
credential: e81f43f32d934271af6322e5376f5f59 credential: e81f43f32d934271af6322e5376f5f59

View File

@ -1,11 +1,11 @@
debug: debug:
print_routes: false print_routes: false
hypertext: hypertext:
sideload_ports: [":81"] administration_ports: [":81"]
sideload_secured_ports: [] administration_secured_ports: []
certificate: certificate:
sideload_key: ./cert.key administration_key: ./cert.key
sideload_pem: ./cert.pem administration_pem: ./cert.pem
key: ./cert.key key: ./cert.key
pem: ./cert.pem pem: ./cert.pem
limitation: limitation:
@ -21,6 +21,6 @@ performance:
network_timeout: 3000 network_timeout: 3000
prefork: true prefork: true
security: security:
sideload_trusted_proxies: administration_trusted_proxies:
- localhost - localhost
credential: e81f43f32d934271af6322e5376f5f59 credential: e81f43f32d934271af6322e5376f5f59

View File

@ -1,11 +1,11 @@
debug: debug:
print_routes: false print_routes: false
hypertext: hypertext:
sideload_ports: [":81"] administration_ports: [":81"]
sideload_secured_ports: [] administration_secured_ports: []
certificate: certificate:
sideload_key: ./cert.key administration_key: ./cert.key
sideload_pem: ./cert.pem administration_pem: ./cert.pem
key: ./cert.key key: ./cert.key
pem: ./cert.pem pem: ./cert.pem
limitation: limitation:
@ -21,6 +21,6 @@ performance:
network_timeout: 3000 network_timeout: 3000
prefork: false prefork: false
security: security:
sideload_trusted_proxies: administration_trusted_proxies:
- localhost - localhost
credential: e81f43f32d934271af6322e5376f5f59 credential: e81f43f32d934271af6322e5376f5f59