mirror of
https://github.com/h44z/wg-portal.git
synced 2025-04-19 08:55:12 +00:00
Initial alpha codebase for version 2 of WireGuard Portal. This version is considered unstable and incomplete (for example, no public REST API)! Use with care! Fixes/Implements the following issues: - OAuth support #154, #1 - New Web UI with internationalisation support #98, #107, #89, #62 - Postgres Support #49 - Improved Email handling #47, #119 - DNS Search Domain support #46 - Bugfixes #94, #48 --------- Co-authored-by: Fabian Wechselberger <wechselbergerf@hotmail.com>
137 lines
3.2 KiB
Go
137 lines
3.2 KiB
Go
package model
|
|
|
|
import (
|
|
"github.com/h44z/wg-portal/internal"
|
|
"github.com/h44z/wg-portal/internal/domain"
|
|
)
|
|
|
|
type StringConfigOption struct {
|
|
Value string `json:"Value"`
|
|
Overridable bool `json:"Overridable"`
|
|
}
|
|
|
|
func NewStringConfigOption(value string, overridable bool) StringConfigOption {
|
|
return StringConfigOption{
|
|
Value: value,
|
|
Overridable: overridable,
|
|
}
|
|
}
|
|
|
|
func StringConfigOptionFromDomain(opt domain.StringConfigOption) StringConfigOption {
|
|
return StringConfigOption{
|
|
Value: opt.Value,
|
|
Overridable: opt.Overridable,
|
|
}
|
|
}
|
|
|
|
func StringConfigOptionToDomain(opt StringConfigOption) domain.StringConfigOption {
|
|
return domain.StringConfigOption{
|
|
Value: opt.Value,
|
|
Overridable: opt.Overridable,
|
|
}
|
|
}
|
|
|
|
type StringSliceConfigOption struct {
|
|
Value []string `json:"Value"`
|
|
Overridable bool `json:"Overridable"`
|
|
}
|
|
|
|
func NewStringSliceConfigOption(value []string, overridable bool) StringSliceConfigOption {
|
|
return StringSliceConfigOption{
|
|
Value: value,
|
|
Overridable: overridable,
|
|
}
|
|
}
|
|
|
|
func StringSliceConfigOptionFromDomain(opt domain.StringConfigOption) StringSliceConfigOption {
|
|
return StringSliceConfigOption{
|
|
Value: internal.SliceString(opt.Value),
|
|
Overridable: opt.Overridable,
|
|
}
|
|
}
|
|
|
|
func StringSliceConfigOptionToDomain(opt StringSliceConfigOption) domain.StringConfigOption {
|
|
return domain.StringConfigOption{
|
|
Value: internal.SliceToString(opt.Value),
|
|
Overridable: opt.Overridable,
|
|
}
|
|
}
|
|
|
|
type IntConfigOption struct {
|
|
Value int `json:"Value"`
|
|
Overridable bool `json:"Overridable"`
|
|
}
|
|
|
|
func NewIntConfigOption(value int, overridable bool) IntConfigOption {
|
|
return IntConfigOption{
|
|
Value: value,
|
|
Overridable: overridable,
|
|
}
|
|
}
|
|
|
|
func IntConfigOptionFromDomain(opt domain.IntConfigOption) IntConfigOption {
|
|
return IntConfigOption{
|
|
Value: opt.Value,
|
|
Overridable: opt.Overridable,
|
|
}
|
|
}
|
|
|
|
func IntConfigOptionToDomain(opt IntConfigOption) domain.IntConfigOption {
|
|
return domain.IntConfigOption{
|
|
Value: opt.Value,
|
|
Overridable: opt.Overridable,
|
|
}
|
|
}
|
|
|
|
type Int32ConfigOption struct {
|
|
Value int32 `json:"Value"`
|
|
Overridable bool `json:"Overridable"`
|
|
}
|
|
|
|
func NewInt32ConfigOption(value int32, overridable bool) Int32ConfigOption {
|
|
return Int32ConfigOption{
|
|
Value: value,
|
|
Overridable: overridable,
|
|
}
|
|
}
|
|
|
|
func Int32ConfigOptionFromDomain(opt domain.Int32ConfigOption) Int32ConfigOption {
|
|
return Int32ConfigOption{
|
|
Value: opt.Value,
|
|
Overridable: opt.Overridable,
|
|
}
|
|
}
|
|
|
|
func Int32ConfigOptionToDomain(opt Int32ConfigOption) domain.Int32ConfigOption {
|
|
return domain.Int32ConfigOption{
|
|
Value: opt.Value,
|
|
Overridable: opt.Overridable,
|
|
}
|
|
}
|
|
|
|
type BoolConfigOption struct {
|
|
Value bool `json:"Value"`
|
|
Overridable bool `json:"Overridable"`
|
|
}
|
|
|
|
func NewBoolConfigOption(value bool, overridable bool) BoolConfigOption {
|
|
return BoolConfigOption{
|
|
Value: value,
|
|
Overridable: overridable,
|
|
}
|
|
}
|
|
|
|
func BoolConfigOptionFromDomain(opt domain.BoolConfigOption) BoolConfigOption {
|
|
return BoolConfigOption{
|
|
Value: opt.Value,
|
|
Overridable: opt.Overridable,
|
|
}
|
|
}
|
|
|
|
func BoolConfigOptionToDomain(opt BoolConfigOption) domain.BoolConfigOption {
|
|
return domain.BoolConfigOption{
|
|
Value: opt.Value,
|
|
Overridable: opt.Overridable,
|
|
}
|
|
}
|