Configuration
Iridium has a global configuration used to configure the entire application.
You can override this state and provide your own configuration. These values are shared across all panels.
Creating a config struct
Create a new configuration instance:
import "github.com/iridiumgo/iridium/config"
conf := config.NewIridiumConfig()Register your custom configuration with your application:
iridium.NewIridiumApp().
RegisterConfig(conf)Common Fields
Below is a list of commonly used configuration fields. For the complete and up-to-date list, see the source code.
App Name
Field: AppName
Specifies the name of your application. This is commonly displayed on the login screen and in navigation headers.
App Icon
Field: AppIcon
Defines the icon used by your application. If no custom icon is provided, Iridium falls back to a default icon.
App Key
Field: AppKey
The session key used by gorilla/sessions. This should be unique and kept secret.
App Locale
Field: AppLocale
Determines the language used by Iridium (for example: "en").
App Environment
Field: AppEnv
Defines the environment your application is running in.
Iridium treats "production" and "prod" as production environments. In production:
- Certain static assets are embedded into the binary
- Internal assertions log errors instead of panicking
All other values ("development", "debug", "test", etc.) are treated as non-production.
App Host
Field: AppHost
The default host Iridium will bind to when using its internal server.
App Port
Field: AppPort
The default port Iridium will bind to when using its internal server.
Time Zone
Field: TimeZone
Sets the internal timezone used by the application. If unset, the system local timezone is used. It is recommended that this matches your database timezone.
Internal Log Level
Field: InternalLogLevel
Controls the verbosity of Iridium’s internal logger. Valid values are:
debuginfowarnerror
Default Screen Size
Field: DefaultScreenSize
Defines the default page width for Iridium’s internal pages.
Multipart Form Memory Size
Field: MultiPartFormSizeBytes
Specifies the maximum amount of multipart form data (in bytes) that may be stored in memory when parsing a request. Any additional data is written to temporary files.
Max Multipart Form Size
Field: MaxMultiPartFormSizeBytes
A hard limit on the total size (including files) of multipart forms Iridium will attempt to parse. Requests exceeding this limit are rejected entirely. This acts as a safeguard against large payload and DDOS-style attacks.
Enable Internal Asserts
Field: EnableInternalAsserts
Controls whether Iridium panics when internal invariants are violated.
- When
true, Iridium will panic on critical developer misconfigurations - When
false, Iridium will log errors instead
This value is automatically set to false in production environments.
HTMX Preload
Field: HTMXPreload
Enables HTMX’s preload extension globally. When enabled, pages may be preloaded on link interaction, making navigation feel faster.
WARNING
Enabling this increases backend and network load and is disabled by default.
See: https://htmx.org/extensions/preload/
Show Startup Banner
Field: ShowStartupBanner
Controls whether the Iridium banner is printed to the terminal on application startup. Only applies when using Iridium’s internal server.
Root Tags
Field: RootTags
Allows you to inject custom attributes or markup into the <head /> section of the root HTML document. This is commonly used for:
- Additional JavaScript includes
- Metadata
- Custom styles
Security warning:
This content is rendered using templ.Raw and is not escaped. Do not populate this field with user-controlled data, as it may introduce XSS vulnerabilities.
Notes
Environment Variables
Iridium does not automatically read configuration values from environment variables. If you wish to configure Iridium using env vars, you must implement this yourself.
You may use any library (such as go-env) to read environment variables and apply them to your configuration struct before registering it with the application.