Removed address, added host and port, removed comments
This commit is contained in:
parent
bd37727a03
commit
a2dfee4a77
@ -1,33 +1,22 @@
|
||||
[auth]
|
||||
# JWT secret
|
||||
secret = "a secret"
|
||||
# Disable registration
|
||||
disabled = false
|
||||
# bcrypt cost
|
||||
# https://pkg.go.dev/golang.org/x/crypto/bcrypt#pkg-constants
|
||||
cost = 10
|
||||
|
||||
[server]
|
||||
# Listener address
|
||||
address = "127.0.0.1:8080"
|
||||
# Read & write timeout
|
||||
# Warning: Too high can
|
||||
# cause a slowloris attack
|
||||
host = "127.0.0.1"
|
||||
port = 8080
|
||||
read_timeout = 10
|
||||
write_timeout = 10
|
||||
|
||||
[database]
|
||||
# Supported drivers:
|
||||
# sqlite3
|
||||
driver = "sqlite3"
|
||||
# URL (For sqlite, use the path)
|
||||
url = "gopay.db"
|
||||
# Max connections
|
||||
max = 30
|
||||
# Max idle connections
|
||||
idle = 30
|
||||
|
||||
[auth]
|
||||
secret = "a secret"
|
||||
register = false
|
||||
# https://pkg.go.dev/golang.org/x/crypto/bcrypt#pkg-constants
|
||||
cost = 10
|
||||
|
||||
|
||||
[log]
|
||||
# Level for database and server
|
||||
# https://pkg.go.dev/github.com/rs/zerolog#Level
|
||||
level = "debug"
|
||||
|
@ -1,37 +1,17 @@
|
||||
// Copyright 2024 perp (supernets)
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package config
|
||||
|
||||
// Configuration
|
||||
type Config struct {
|
||||
Auth *Auth
|
||||
Server *Server
|
||||
Database *Database
|
||||
Auth *Auth
|
||||
Log *Log
|
||||
}
|
||||
|
||||
// Auth configuration
|
||||
type Auth struct {
|
||||
Secret string `toml:"secret"`
|
||||
Disabled bool `toml:"disabled"`
|
||||
Cost int `toml:"cost"`
|
||||
}
|
||||
|
||||
// Server configuration
|
||||
type Server struct {
|
||||
Address string `toml:"address"`
|
||||
Host string `toml:"host"`
|
||||
Port int `toml:"port"`
|
||||
ReadTimeout int `toml:"read_timeout"`
|
||||
WriteTimeout int `toml:"write_timeout"`
|
||||
}
|
||||
@ -44,6 +24,13 @@ type Database struct {
|
||||
Idle int `toml:"idle"`
|
||||
}
|
||||
|
||||
// Auth configuration
|
||||
type Auth struct {
|
||||
Secret string `toml:"secret"`
|
||||
Register bool `toml:"register"`
|
||||
Cost int `toml:"cost"`
|
||||
}
|
||||
|
||||
// Log configuration
|
||||
type Log struct {
|
||||
Level string `toml:"level"`
|
||||
|
@ -1,17 +1,3 @@
|
||||
// Copyright 2024 perp (supernets)
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package config
|
||||
|
||||
import (
|
||||
|
Loading…
Reference in New Issue
Block a user