index.md (3394B)
1 # Configuration Overview 2 3 GoToSocial aims to be as configurable as possible, to fit lots of different use cases. 4 5 We try to provide sensible defaults wherever possible, but you can't run a GoToSocial instance without managing *some* configuration. 6 7 ## Configuration Methods 8 9 There are three different methods for configuring a GoToSocial instance, which can be combined depending on your setup. 10 11 ### Configuration File 12 13 The easiest way to configure GoToSocial is to pass a configuration file to to the `gotosocial server start` command, for example: 14 15 ```bash 16 gotosocial --config-path ./config.yaml server start 17 ``` 18 19 The command expects a file in [YAML](https://en.wikipedia.org/wiki/YAML) or [JSON](https://en.wikipedia.org/wiki/JSON) format. 20 21 An example configuration file, with an explanation of each of the config fields, with default and example values, can be found [here](https://github.com/superseriousbusiness/gotosocial/blob/main/example/config.yaml). 22 23 This example file is included with release downloads, so you can just copy it and edit it to your needs without having to worry too much about what the hell YAML or JSON is. 24 25 ### Environment Variables 26 27 You can also configure GoToSocial by setting [environment variables](https://en.wikipedia.org/wiki/Environment_variable). These environment variables follow the format: 28 29 1. Prepend `GTS_` to the config flag. 30 2. Uppercase-all. 31 3. Replace dash (`-`) with underscore (`_`). 32 33 So for example, instead of setting `media-image-max-size` to `2097152` in your config.yaml, you could set the environment variable: 34 35 ```text 36 GTS_MEDIA_IMAGE_MAX_SIZE=2097152 37 ``` 38 39 If you're in doubt about any of the names of these environment variables, just check the `--help` for the subcommand you're using. 40 41 ### Command Line Flags 42 43 Finally, you can set configuration values using command-line flags, which you pass directly when you're running a `gotosocial` command. For example, instead of setting `media-image-max-size` in your config.yaml, or with an environment variable, you can pass the value directly through the command line: 44 45 ```bash 46 gotosocial server start --media-image-max-size 2097152 47 ``` 48 49 If you're in doubt about which flags are available, check `gotosocial --help`. 50 51 ## Priority 52 53 The above configuration methods override each other in the order in which they were listed. 54 55 ```text 56 command line flags > environment variables > config file 57 ``` 58 59 That is, if you set `media-image-max-size` to `2097152` in your config file, but then *ALSO* set the environment variable `GTS_MEDIA_MAX_IMAGE_SIZE=9999999`, then the final value will be `9999999`, because environment variables have a *higher priority* than values set in config.yaml. 60 61 Command line flags have the highest priority, so if you set `--media-image-max-size 13121312`, then the final value will be `13121312` regardless of what you've set elsewhere. 62 63 This means in cases where you want to just try changing one thing, but don't want to edit your config file, you can temporarily use an environment variable or a command line flag to set that one thing. 64 65 ## Default Values 66 67 Reasonable default values are provided for *most* of the configuration parameters, except in cases where a custom value is absolutely required. 68 69 See the [example config file](https://github.com/superseriousbusiness/gotosocial/blob/main/example/config.yaml) for the default values, or run `gotosocial --help`.