From daf0c3b4896bcd382a5d7f544ec3d312340cdd93 Mon Sep 17 00:00:00 2001 From: mStar Date: Thu, 21 Nov 2024 13:37:24 +0100 Subject: [PATCH] Update config to include s3 storage service --- config/config.go | 18 +++++++++++++ example_config.toml | 62 ++++++++++----------------------------------- 2 files changed, 31 insertions(+), 49 deletions(-) diff --git a/config/config.go b/config/config.go index f16914a..db496ef 100644 --- a/config/config.go +++ b/config/config.go @@ -70,6 +70,13 @@ type ConfigStorage struct { 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 { Host string `toml:"host"` Port int `toml:"port"` @@ -95,6 +102,7 @@ type Config struct { Storage ConfigStorage `toml:"storage"` Mail ConfigMail `toml:"mail"` Self ConfigSelf `toml:"self"` + S3 ConfigS3 `toml:"s3"` } var GlobalConfig Config @@ -147,6 +155,16 @@ var defaultConfig Config = Config{ SendTimeoutSecondsOverwrite: 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 { diff --git a/example_config.toml b/example_config.toml index 4cc3d7b..6fb5564 100644 --- a/example_config.toml +++ b/example_config.toml @@ -1,78 +1,42 @@ [general] - # The protocol the server is reachable at from public protocol = "http" - # The domain the server is reachable at from public 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 - # 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] - # Whether the server should handle ssl itself 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] - # The username of the root admin account 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" + profiling_password = "Example profiling password" [webauthn] - # Display name of the server while registering with a passkey display_name = "Linstrom" [storage] - # Host domain or ip where the postgres db is located host = "localhost" - # Username to log into the postgres db username = "linstrom" - # Password for the given username password = "linstrom" - # The name of the database inside postgres db_name = "linstrom" - # The port where the postgres db is located port = 5432 - # The ssl mode to use while connecting to postgres. May be empty ssl_mode = "disable" - # What timezone to use for times. May be empty 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 = 1_000_000 - # 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 + max_in_memory_cache_size = 1000000 + max_in_memory_cache_ttl = 5 [mail] - # The ip or domain of the smtp server for sending mail host = "localhost" - # The port under which the smtp server is reachable port = 587 - # The username to use for authentication with the smtp server username = "linstrom" - # The password associated with the username password = "linstrom" - # Overwrite the encryption to use while sending mails - # encryption_overwrite = "STARTTLS" - # Overwrite whether to keep connections to the smtp server alive for future use - # keep_alive_overwrite = true - # Overwrite the timeout duration for connecting to the smtp server - # connect_timeout_seconds_overwrite = 30 - # Overwrite the timeout duration for sending a mail - # send_timeout_seconds_overwrite = 30 - # Overwrite the location of email template files to use custom ones - # template_overwrite_directory = "/path/to/some/directory" + +[self] + server_actor_display_name = "Server actor" + server_display_name = "Linstrom" + +[s3] + key_id = "Example key ID" + secret = "Example key secret" + region = "Example region" + endpoint = "http://localhost:3900"