| 12 | ) |
| 13 | |
| 14 | type Config struct { |
| 15 | // Version of the server |
| 16 | Version string `mapstructure:"VERSION"` |
| 17 | // Accessible server address |
| 18 | CdnURL string `mapstructure:"CDN_URL"` |
| 19 | // The port to run the server on |
| 20 | ServerPort int `mapstructure:"SERVER_PORT"` |
| 21 | // This enables extra logging, INCLUDING SENSETIVE INFORMATION like BLUESKY TOKENS. Useful for debugging with tools like insomnia. DO NOT USE ON PUBLIC SERVERS |
| 22 | // Also requires all passwords start with "dev_" to work |
| 23 | DeveloperMode bool `mapstructure:"DEVELOPER_MODE"` |
| 24 | // Collects analytics on users. |
| 25 | TrackAnalytics bool `mapstructure:"TRACK_ANALYTICS"` |
| 26 | // Database type (mysql, postgres, sqlite) |
| 27 | DatabaseType string `mapstructure:"DATABASE_TYPE"` |
| 28 | // Database path |
| 29 | DatabasePath string `mapstructure:"DATABASE_PATH"` |
| 30 | |
| 31 | UseXForwardedFor bool `mapstructure:"USE_X_FORWARDED_FOR"` |
| 32 | |
| 33 | ImgDisplayText string `mapstructure:"IMG_DISPLAY_TEXT"` |
| 34 | ImgURLText string `mapstructure:"IMG_URL_TEXT"` |
| 35 | VidDisplayText string `mapstructure:"VID_DISPLAY_TEXT"` |
| 36 | VidURLText string `mapstructure:"VID_URL_TEXT"` |
| 37 | |
| 38 | // Secret key used for JWT. Must be at least 32 bytes long. Keep this secret! |
| 39 | SecretKey string `mapstructure:"SECRET_KEY"` |
| 40 | // The security key but in bytes. |
| 41 | SecretKeyBytes []byte |
| 42 | // Min Version token version the server will accept |
| 43 | MinTokenVersion int `mapstructure:"MIN_TOKEN_VERSION"` |
| 44 | // Server Identifier, used for knowing what server a token belongs to. |
| 45 | ServerIdentifier string `mapstructure:"SERVER_IDENTIFIER"` |
| 46 | // Server URLs used for contacting the server |
| 47 | ServerURLs []string `mapstructure:"SERVER_URLS"` |
| 48 | } |
| 49 | |
| 50 | // Loads our config files. |
| 51 | func LoadConfig() (*Config, error) { |
nothing calls this directly
no outgoing calls
no test coverage detected