mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-27 12:05:26 +00:00
Switch config to pointer
This commit is contained in:
parent
af891808f6
commit
78ed610b50
4
app.go
4
app.go
@ -71,7 +71,7 @@ const (
|
|||||||
|
|
||||||
// Headscale represents the base app of the service.
|
// Headscale represents the base app of the service.
|
||||||
type Headscale struct {
|
type Headscale struct {
|
||||||
cfg Config
|
cfg *Config
|
||||||
db *gorm.DB
|
db *gorm.DB
|
||||||
dbString string
|
dbString string
|
||||||
dbType string
|
dbType string
|
||||||
@ -115,7 +115,7 @@ func LookupTLSClientAuthMode(mode string) (tls.ClientAuthType, bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHeadscale(cfg Config) (*Headscale, error) {
|
func NewHeadscale(cfg *Config) (*Headscale, error) {
|
||||||
privKey, err := readOrCreatePrivateKey(cfg.PrivateKeyPath)
|
privKey, err := readOrCreatePrivateKey(cfg.PrivateKeyPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to read or create private key: %w", err)
|
return nil, fmt.Errorf("failed to read or create private key: %w", err)
|
||||||
|
@ -46,7 +46,7 @@ func (s *Suite) ResetDB(c *check.C) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
app = Headscale{
|
app = Headscale{
|
||||||
cfg: cfg,
|
cfg: &cfg,
|
||||||
dbType: "sqlite3",
|
dbType: "sqlite3",
|
||||||
dbString: tmpDir + "/headscale_test.db",
|
dbString: tmpDir + "/headscale_test.db",
|
||||||
}
|
}
|
||||||
|
@ -821,7 +821,7 @@ func TestHeadscale_GenerateGivenName(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "simple machine name generation",
|
name: "simple machine name generation",
|
||||||
h: &Headscale{
|
h: &Headscale{
|
||||||
cfg: Config{
|
cfg: &Config{
|
||||||
OIDC: OIDCConfig{
|
OIDC: OIDCConfig{
|
||||||
StripEmaildomain: true,
|
StripEmaildomain: true,
|
||||||
},
|
},
|
||||||
@ -836,7 +836,7 @@ func TestHeadscale_GenerateGivenName(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "machine name with 53 chars",
|
name: "machine name with 53 chars",
|
||||||
h: &Headscale{
|
h: &Headscale{
|
||||||
cfg: Config{
|
cfg: &Config{
|
||||||
OIDC: OIDCConfig{
|
OIDC: OIDCConfig{
|
||||||
StripEmaildomain: true,
|
StripEmaildomain: true,
|
||||||
},
|
},
|
||||||
@ -851,7 +851,7 @@ func TestHeadscale_GenerateGivenName(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "machine name with 60 chars",
|
name: "machine name with 60 chars",
|
||||||
h: &Headscale{
|
h: &Headscale{
|
||||||
cfg: Config{
|
cfg: &Config{
|
||||||
OIDC: OIDCConfig{
|
OIDC: OIDCConfig{
|
||||||
StripEmaildomain: true,
|
StripEmaildomain: true,
|
||||||
},
|
},
|
||||||
@ -866,7 +866,7 @@ func TestHeadscale_GenerateGivenName(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "machine name with 63 chars",
|
name: "machine name with 63 chars",
|
||||||
h: &Headscale{
|
h: &Headscale{
|
||||||
cfg: Config{
|
cfg: &Config{
|
||||||
OIDC: OIDCConfig{
|
OIDC: OIDCConfig{
|
||||||
StripEmaildomain: true,
|
StripEmaildomain: true,
|
||||||
},
|
},
|
||||||
@ -881,7 +881,7 @@ func TestHeadscale_GenerateGivenName(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "machine name with 64 chars",
|
name: "machine name with 64 chars",
|
||||||
h: &Headscale{
|
h: &Headscale{
|
||||||
cfg: Config{
|
cfg: &Config{
|
||||||
OIDC: OIDCConfig{
|
OIDC: OIDCConfig{
|
||||||
StripEmaildomain: true,
|
StripEmaildomain: true,
|
||||||
},
|
},
|
||||||
@ -896,7 +896,7 @@ func TestHeadscale_GenerateGivenName(t *testing.T) {
|
|||||||
{
|
{
|
||||||
name: "machine name with 73 chars",
|
name: "machine name with 73 chars",
|
||||||
h: &Headscale{
|
h: &Headscale{
|
||||||
cfg: Config{
|
cfg: &Config{
|
||||||
OIDC: OIDCConfig{
|
OIDC: OIDCConfig{
|
||||||
StripEmaildomain: true,
|
StripEmaildomain: true,
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user