feature (license): mechanism to override default license

This commit is contained in:
MickaelK 2025-08-28 10:47:31 +10:00
parent 3b48a5fa80
commit 1c3736e6f2

View file

@ -15,8 +15,9 @@ type license struct {
} }
func init() { func init() {
lenv := os.Getenv("LICENSE")
Hooks.Register.Onload(func() { Hooks.Register.Onload(func() {
if LICENSE != "agpl" { if LICENSE != "agpl" && lenv == "" {
return return
} }
data, err := DecryptString(fmt.Sprintf("%-16s", "filestash"), Config.Get("general.license").Schema(func(f *FormElement) *FormElement { data, err := DecryptString(fmt.Sprintf("%-16s", "filestash"), Config.Get("general.license").Schema(func(f *FormElement) *FormElement {
@ -27,9 +28,8 @@ func init() {
f.Type = "text" f.Type = "text"
f.Placeholder = "License Key" f.Placeholder = "License Key"
f.Description = "Reach out to support@filestash.app to get your license" f.Description = "Reach out to support@filestash.app to get your license"
lenv := os.Getenv("LICENSE")
if lenv != "" { if lenv != "" {
f.Value = os.Getenv("LICENSE") f.Value = lenv
f.ReadOnly = true f.ReadOnly = true
} }
return f return f