Update config to include s3 storage service

This commit is contained in:
Melody Becker 2024-11-21 13:37:24 +01:00
parent a94a360773
commit daf0c3b489
2 changed files with 31 additions and 49 deletions

View file

@ -70,6 +70,13 @@ type ConfigStorage struct {
MaxRedisCacheTTL *int `toml:"max_redis_cache_ttl"` MaxRedisCacheTTL *int `toml:"max_redis_cache_ttl"`
} }
type ConfigS3 struct {
KeyId string `toml:"key_id"`
Secret string `toml:"secret"`
Region string `toml:"region"`
Endpoint string `toml:"endpoint"`
}
type ConfigMail struct { type ConfigMail struct {
Host string `toml:"host"` Host string `toml:"host"`
Port int `toml:"port"` Port int `toml:"port"`
@ -95,6 +102,7 @@ type Config struct {
Storage ConfigStorage `toml:"storage"` Storage ConfigStorage `toml:"storage"`
Mail ConfigMail `toml:"mail"` Mail ConfigMail `toml:"mail"`
Self ConfigSelf `toml:"self"` Self ConfigSelf `toml:"self"`
S3 ConfigS3 `toml:"s3"`
} }
var GlobalConfig Config var GlobalConfig Config
@ -147,6 +155,16 @@ var defaultConfig Config = Config{
SendTimeoutSecondsOverwrite: nil, SendTimeoutSecondsOverwrite: nil,
TemplateOverwriteDirectory: nil, TemplateOverwriteDirectory: nil,
}, },
Self: ConfigSelf{
ServerActorDisplayName: "Server actor",
ServerDisplayName: "Linstrom",
},
S3: ConfigS3{
KeyId: "Example key ID",
Secret: "Example key secret",
Region: "Example region",
Endpoint: "http://localhost:3900",
},
} }
func (gc *ConfigGeneral) GetFullDomain() string { func (gc *ConfigGeneral) GetFullDomain() string {

View file

@ -1,78 +1,42 @@
[general] [general]
# The protocol the server is reachable at from public
protocol = "http" protocol = "http"
# The domain the server is reachable at from public
domain = "localhost" domain = "localhost"
# The subdomain where the server can be found. Can be not set
# subdomain = "example"
# The port under which the server itself runs. May not be the public port
private_port = 8080 private_port = 8080
# The port under which the server is accessible from public, usually 443 or 80
# public_port = 443
# Log file to write a machine readable version (json) of logs into. Can be not set
# structured_log_file = "log.txt"
[ssl] [ssl]
# Whether the server should handle ssl itself
handle_ssl = false handle_ssl = false
# Whether to use letsEncrypt for obtaining ssl certificates
# use_lets_encrypt=true
# Location of the certificate file if not using lets encrypt
# certificate_file = "/path/to/certificate"
# Admin email adress to use for lets encrypt
# admin_mail = "admin@example.com"
[admin] [admin]
# The username of the root admin account
username = "server-admin" username = "server-admin"
# First time password for initial setup.
# Only used once after first run to verify that the person accessing the admin is supposed to do so
first_time_setup_otp = "Example otp password" first_time_setup_otp = "Example otp password"
profiling_password = "Example profiling password"
[webauthn] [webauthn]
# Display name of the server while registering with a passkey
display_name = "Linstrom" display_name = "Linstrom"
[storage] [storage]
# Host domain or ip where the postgres db is located
host = "localhost" host = "localhost"
# Username to log into the postgres db
username = "linstrom" username = "linstrom"
# Password for the given username
password = "linstrom" password = "linstrom"
# The name of the database inside postgres
db_name = "linstrom" db_name = "linstrom"
# The port where the postgres db is located
port = 5432 port = 5432
# The ssl mode to use while connecting to postgres. May be empty
ssl_mode = "disable" ssl_mode = "disable"
# What timezone to use for times. May be empty
time_zone = "Europe/Berlin" time_zone = "Europe/Berlin"
# The maximum size of the in memory cache, in bytes. 1_000_000 is one megabyte max_in_memory_cache_size = 1000000
max_in_memory_cache_size = 1_000_000 max_in_memory_cache_ttl = 5
# The maximum time entries in the in-memory cache stay in there, in seconds
MaxInMemoryCacheTTL = 5
# The url to a redis server to use as secondary cache (after the internal in-memory one)
# redis_url = "some-redis-url"
# The maximum amount of seconds entries may stay in the redis cache
# max_redis_cache_ttl = 10
[mail] [mail]
# The ip or domain of the smtp server for sending mail
host = "localhost" host = "localhost"
# The port under which the smtp server is reachable
port = 587 port = 587
# The username to use for authentication with the smtp server
username = "linstrom" username = "linstrom"
# The password associated with the username
password = "linstrom" password = "linstrom"
# Overwrite the encryption to use while sending mails
# encryption_overwrite = "STARTTLS" [self]
# Overwrite whether to keep connections to the smtp server alive for future use server_actor_display_name = "Server actor"
# keep_alive_overwrite = true server_display_name = "Linstrom"
# Overwrite the timeout duration for connecting to the smtp server
# connect_timeout_seconds_overwrite = 30 [s3]
# Overwrite the timeout duration for sending a mail key_id = "Example key ID"
# send_timeout_seconds_overwrite = 30 secret = "Example key secret"
# Overwrite the location of email template files to use custom ones region = "Example region"
# template_overwrite_directory = "/path/to/some/directory" endpoint = "http://localhost:3900"