diff options
author | 2021-12-07 13:31:39 +0100 | |
---|---|---|
committer | 2021-12-07 13:31:39 +0100 | |
commit | 0884f89431cd26bcc9674b3b7ab628b090f5881e (patch) | |
tree | cdd3b3f77f780a8b59d075dbcc3d4d013811e405 /docs | |
parent | Update dependencies (#333) (diff) | |
download | gotosocial-0884f89431cd26bcc9674b3b7ab628b090f5881e.tar.xz |
Implement Cobra CLI tooling, Viper config tooling (#336)
* start pulling out + replacing urfave and config
* replace many many instances of config
* move more stuff => viper
* properly remove urfave
* move some flags to root command
* add testrig commands to root
* alias config file keys
* start adding cli parsing tests
* reorder viper init
* remove config path alias
* fmt
* change config file keys to non-nested
* we're more or less in business now
* tidy up the common func
* go fmt
* get tests passing again
* add note about the cliparsing tests
* reorganize
* update docs with changes
* structure cmd dir better
* rename + move some files around
* fix dangling comma
Diffstat (limited to 'docs')
-rw-r--r-- | docs/admin/cli.md | 158 | ||||
-rw-r--r-- | docs/configuration/accounts.md | 25 | ||||
-rw-r--r-- | docs/configuration/database.md | 95 | ||||
-rw-r--r-- | docs/configuration/general.md | 10 | ||||
-rw-r--r-- | docs/configuration/index.md | 32 | ||||
-rw-r--r-- | docs/configuration/letsencrypt.md | 55 | ||||
-rw-r--r-- | docs/configuration/media.md | 33 | ||||
-rw-r--r-- | docs/configuration/oidc.md | 95 | ||||
-rw-r--r-- | docs/configuration/smtp.md | 55 | ||||
-rw-r--r-- | docs/configuration/statuses.md | 74 | ||||
-rw-r--r-- | docs/configuration/storage.md | 69 | ||||
-rw-r--r-- | docs/configuration/template.md | 22 | ||||
-rw-r--r-- | docs/configuration/web.md | 21 | ||||
-rw-r--r-- | docs/installation_guide/binary.md | 8 | ||||
-rw-r--r-- | docs/installation_guide/index.md | 2 |
15 files changed, 366 insertions, 388 deletions
diff --git a/docs/admin/cli.md b/docs/admin/cli.md index e15daf084..a65282ceb 100644 --- a/docs/admin/cli.md +++ b/docs/admin/cli.md @@ -4,35 +4,34 @@ GoToSocial compiles to an executable binary. The standard way of using this binary is to run a server with the `gotosocial server start` command. -However, this binary can also be used as an admin tool. +However, this binary can also be used as an admin tool, and for debugging. Here's the full output of `gotosocial --help`, without the big list of global config options. ```text -NAME: - gotosocial - a fediverse social media server +GoToSocial - a fediverse social media server -USAGE: - gotosocial [global options] command [command options] [arguments...] +For help, see: https://docs.gotosocial.org. -VERSION: - 0.1.0-SNAPSHOT a940a52 +Code: https://github.com/superseriousbusiness/gotosocial -COMMANDS: - server gotosocial server-related tasks - admin gotosocial admin-related tasks - testrig gotosocial testrig tasks - help, h Shows a list of commands or help for one command +Usage: + gotosocial [command] -GLOBAL OPTIONS: - [a huge list of global options -- too much to show here] +Available Commands: + admin gotosocial admin-related tasks + completion generate the autocompletion script for the specified shell + debug gotosocial debug-related tasks + help Help about any command + server gotosocial server-related tasks + testrig gotosocial testrig-related tasks ``` -Under `COMMANDS`, you can see the standard `server` command. But there are also commands doing admin and testing etc, which will be explained in this document. +Under `Available Commands`, you can see the standard `server` command. But there are also commands doing admin and testing etc, which will be explained in this document. **Please note -- for all of these commands, you will still need to set the global options correctly so that the CLI tool knows how eg., how to connect to your database, which database to use, which host and account domain to use etc.** -You can set these global options using environment variables, passing them as CLI variables after the `gotosocial` part of the command (eg., `gotosocial --host example.org [commands]`), or by just pointing the CLI tool towards your config file (eg., `gotosocial --config-path ./config.yaml [commands]`). +You can set these options using environment variables, passing them as CLI flags (eg., `gotosocial [commands] --host example.org`), or by just pointing the CLI tool towards your config file (eg., `gotosocial [commands] --config-path ./config.yaml`). ## gotosocial admin @@ -45,17 +44,16 @@ This command can be used to create a new account on your instance. `gotosocial admin account create --help`: ```text -NAME: - gotosocial admin account create - create a new account +create a new account -USAGE: - gotosocial admin account create [command options] [arguments...] +Usage: + gotosocial admin account create [flags] -OPTIONS: - --username value the username to create/delete/etc - --email value the email address of this account - --password value the password to set for this account - --help, -h show help (default: false) +Flags: + --email string the email address of this account + -h, --help help for create + --password string the password to set for this account + --username string the username to create/delete/etc ``` Example: @@ -74,15 +72,14 @@ This command can be used to confirm a user+account on your instance, allowing th `gotosocial admin account confirm --help`: ```text -NAME: - gotosocial admin account confirm - confirm an existing account manually, thereby skipping email confirmation +confirm an existing account manually, thereby skipping email confirmation -USAGE: - gotosocial admin account confirm [command options] [arguments...] +Usage: + gotosocial admin account confirm [flags] -OPTIONS: - --username value the username to create/delete/etc - --help, -h show help (default: false) +Flags: + -h, --help help for confirm + --username string the username to create/delete/etc ``` Example: @@ -98,15 +95,14 @@ This command can be used to promote a user to admin. `gotosocial admin account promote --help`: ```text -NAME: - gotosocial admin account promote - promote an account to admin +promote an account to admin -USAGE: - gotosocial admin account promote [command options] [arguments...] +Usage: + gotosocial admin account promote [flags] -OPTIONS: - --username value the username to create/delete/etc - --help, -h show help (default: false) +Flags: + -h, --help help for promote + --username string the username to create/delete/etc ``` Example: @@ -122,15 +118,14 @@ This command can be used to demote a user from admin to normal user. `gotosocial admin account demote --help`: ```text -NAME: - gotosocial admin account demote - demote an account from admin to normal user +demote an account from admin to normal user -USAGE: - gotosocial admin account demote [command options] [arguments...] +Usage: + gotosocial admin account demote [flags] -OPTIONS: - --username value the username to create/delete/etc - --help, -h show help (default: false) +Flags: + -h, --help help for demote + --username string the username to create/delete/etc ``` Example: @@ -146,15 +141,14 @@ This command can be used to disable an account: prevent it from signing in or do `gotosocial admin account disable --help`: ```text -NAME: - gotosocial admin account disable - prevent an account from signing in or posting etc, but don't delete anything +prevent an account from signing in or posting etc, but don't delete anything -USAGE: - gotosocial admin account disable [command options] [arguments...] +Usage: + gotosocial admin account disable [flags] -OPTIONS: - --username value the username to create/delete/etc - --help, -h show help (default: false) +Flags: + -h, --help help for disable + --username string the username to create/delete/etc ``` Example: @@ -172,15 +166,14 @@ In other words, this 'deletes' the account (without actually removing the accoun `gotosocial admin account suspend --help`: ```text -NAME: - gotosocial admin account suspend - completely remove an account and all of its posts, media, etc +completely remove an account and all of its posts, media, etc -USAGE: - gotosocial admin account suspend [command options] [arguments...] +Usage: + gotosocial admin account suspend [flags] -OPTIONS: - --username value the username to create/delete/etc - --help, -h show help (default: false) +Flags: + -h, --help help for suspend + --username string the username to create/delete/etc ``` Example: @@ -196,16 +189,15 @@ This command can be used to set a new password on the given account. `gotosocial admin account password --help`: ```text -NAME: - gotosocial admin account password - set a new password for the given account +set a new password for the given account -USAGE: - gotosocial admin account password [command options] [arguments...] +Usage: + gotosocial admin account password [flags] -OPTIONS: - --username value the username to create/delete/etc - --password value the password to set for this account - --help, -h show help (default: false) +Flags: + -h, --help help for password + --password string the password to set for this account + --username string the username to create/delete/etc ``` Example: @@ -223,21 +215,20 @@ The file format will be a series of newline-separated JSON objects. `gotosocial admin export --help`: ```text -NAME: - gotosocial admin export - export data from the database to file at the given path +export data from the database to file at the given path -USAGE: - gotosocial admin export [command options] [arguments...] +Usage: + gotosocial admin export [flags] -OPTIONS: - --path value the path of the file to import from/export to - --help, -h show help (default: false) +Flags: + -h, --help help for export + --path string the path of the file to import from/export to ``` Example: ```bash -gotosocial admin export --path ./example.json +gotosocial admin export --config-file ./config.yaml --path ./example.json ``` `example.json`: @@ -272,19 +263,18 @@ The file format should be a series of newline-separated JSON objects (see above) `gotosocial admin import --help`: ```text -NAME: - gotosocial admin import - import data from a file into the database +import data from a file into the database -USAGE: - gotosocial admin import [command options] [arguments...] +Usage: + gotosocial admin import [flags] -OPTIONS: - --path value the path of the file to import from/export to - --help, -h show help (default: false) +Flags: + -h, --help help for import + --path string the path of the file to import from/export to ``` Example: ```bash -gotosocial admin import --path ./example.json +gotosocial admin import --config-file ./config.yaml --path ./example.json ``` diff --git a/docs/configuration/accounts.md b/docs/configuration/accounts.md index e77bc92fc..edb647a1b 100644 --- a/docs/configuration/accounts.md +++ b/docs/configuration/accounts.md @@ -8,20 +8,19 @@ ########################### # Config pertaining to creation and maintenance of accounts on the server, as well as defaults for new accounts. -accounts: - # Bool. Do we want people to be able to just submit sign up requests, or do we want invite only? - # Options: [true, false] - # Default: true - openRegistration: true +# Bool. Do we want people to be able to just submit sign up requests, or do we want invite only? +# Options: [true, false] +# Default: true +accounts-registration-open: true - # Bool. Do sign up requests require approval from an admin/moderator before an account can sign in/use the server? - # Options: [true, false] - # Default: true - requireApproval: true +# Bool. Do sign up requests require approval from an admin/moderator before an account can sign in/use the server? +# Options: [true, false] +# Default: true +accounts-approval-required: true - # Bool. Are sign up requests required to submit a reason for the request (eg., an explanation of why they want to join the instance)? - # Options: [true, false] - # Default: true - reasonRequired: true +# Bool. Are sign up requests required to submit a reason for the request (eg., an explanation of why they want to join the instance)? +# Options: [true, false] +# Default: true +accounts-reason-required: true ``` diff --git a/docs/configuration/database.md b/docs/configuration/database.md index 0c6cf692e..6acc2e9ec 100644 --- a/docs/configuration/database.md +++ b/docs/configuration/database.md @@ -8,7 +8,7 @@ By default, GoToSocial will use Postgres, but this is easy to change. SQLite, as the name implies, is the lightest database type that GoToSocial can use. It stores entries in a simple file format, usually in the same directory as the GoToSocial binary itself. SQLite is great for small instances and lower-powered machines like Raspberry Pi, where a dedicated database would be overkill. -To configure GoToSocial to use SQLite, change `db.type` to `sqlite`. The `address` setting will then be a filename instead of an address, so you might want to change it to `sqlite.db` or something similar. +To configure GoToSocial to use SQLite, change `db-type` to `sqlite`. The `address` setting will then be a filename instead of an address, so you might want to change it to `sqlite.db` or something similar. Note that the `:memory:` setting will use an *in-memory database* which will be wiped when your GoToSocial instance stops running. This is for testing only and is absolutely not suitable for running a proper instance, so *don't do this*. @@ -18,7 +18,7 @@ Postgres is a heavier database format, which is useful for larger instances wher GoToSocial supports connecting to Postgres using SSL/TLS. If you're running Postgres on a different machine from GoToSocial, and connecting to it via an IP address or hostname (as opposed to just running on localhost), then SSL/TLS is **CRUCIAL** to avoid leaking data all over the place! -When you're using Postgres, GoToSocial expects whatever you've set for `db.user` to already be created in the database, and to have ownership of whatever you've set for `db.database`. +When you're using Postgres, GoToSocial expects whatever you've set for `db-user` to already be created in the database, and to have ownership of whatever you've set for `db-database`. For example, if you set: @@ -48,51 +48,50 @@ grant all privileges on database gotosocial to gotosocial; ############################ # Config pertaining to the Gotosocial database connection -db: - # String. Database type. - # Options: ["postgres","sqlite"] - # Default: "postgres" - type: "postgres" - - # String. Database address or parameters. - # Examples: ["localhost","my.db.host","127.0.0.1","192.111.39.110",":memory:"] - # Default: "localhost" - address: "127.0.0.1" - - # Int. Port for database connection. - # Examples: [5432, 1234, 6969] - # Default: 5432 - port: 5432 - - # String. Username for the database connection. - # Examples: ["mydbuser","postgres","gotosocial"] - # Default: "postgres" - user: "postgres" - - # REQUIRED - # String. Password to use for the database connection - # Examples: ["password123","verysafepassword","postgres"] - # Default: "postgres" - password: "postgres" - - # String. Name of the database to use within the provided database type. - # Examples: ["mydb","postgres","gotosocial"] - # Default: "postgres" - database: "postgres" - - # String. Disable, enable, or require SSL/TLS connection to the database. - # If "disable" then no TLS connection will be attempted. - # If "enable" then TLS will be tried, but the database certificate won't be checked (for self-signed certs). - # If "require" then TLS will be required to make a connection, and a valid certificate must be presented. - # Options: ["disable", "enable", "require"] - # Default: "disable" - tlsMode: "disable" - - # String. Path to a CA certificate on the host machine for db certificate validation. - # If this is left empty, just the host certificates will be used. - # If filled in, the certificate will be loaded and added to host certificates. - # Examples: ["/path/to/some/cert.crt"] - # Default: "" - tlsCACert: "" +# String. Database type. +# Options: ["postgres","sqlite"] +# Default: "postgres" +db-type: "postgres" + +# String. Database address or parameters. +# Examples: ["localhost","my.db.host","127.0.0.1","192.111.39.110",":memory:"] +# Default: "localhost" +db-address: "127.0.0.1" + +# Int. Port for database connection. +# Examples: [5432, 1234, 6969] +# Default: 5432 +db-port: 5432 + +# String. Username for the database connection. +# Examples: ["mydbuser","postgres","gotosocial"] +# Default: "postgres" +db-user: "postgres" + +# REQUIRED +# String. Password to use for the database connection +# Examples: ["password123","verysafepassword","postgres"] +# Default: "postgres" +db-password: "postgres" + +# String. Name of the database to use within the provided database type. +# Examples: ["mydb","postgres","gotosocial"] +# Default: "postgres" +db-database: "postgres" + +# String. Disable, enable, or require SSL/TLS connection to the database. +# If "disable" then no TLS connection will be attempted. +# If "enable" then TLS will be tried, but the database certificate won't be checked (for self-signed certs). +# If "require" then TLS will be required to make a connection, and a valid certificate must be presented. +# Options: ["disable", "enable", "require"] +# Default: "disable" +db-tls-mode: "disable" + +# String. Path to a CA certificate on the host machine for db certificate validation. +# If this is left empty, just the host certificates will be used. +# If filled in, the certificate will be loaded and added to host certificates. +# Examples: ["/path/to/some/cert.crt"] +# Default: "" +db-tls-ca-cert: "" ``` diff --git a/docs/configuration/general.md b/docs/configuration/general.md index be27095d1..5e23d4699 100644 --- a/docs/configuration/general.md +++ b/docs/configuration/general.md @@ -14,12 +14,12 @@ The only things you *really* need to set here are `host`, which should be the ho # String. Log level to use throughout the application. Must be lower-case. # Options: ["trace","debug","info","warn","error","fatal"] # Default: "info" -logLevel: "info" +log-level: "info" # String. Application name to use internally. # Examples: ["My Application","gotosocial"] # Default: "gotosocial" -applicationName: "gotosocial" +application-name: "gotosocial" # String. Hostname that this server will be reachable at. Defaults to localhost for local testing, # but you should *definitely* change this when running for real, or your server won't work at all. @@ -38,7 +38,7 @@ host: "localhost" # DO NOT change this after your server has already run once, or you will break things! # Examples: ["example.org","server.com"] # Default: "" -accountDomain: "" +account-domain: "" # String. Protocol to use for the server. Only change to http for local testing! # This should be the protocol part of the URI that your server is actually reachable on. So even if you're @@ -55,7 +55,7 @@ protocol: "https" # you have specific networking requirements. # Examples: ["0.0.0.0", "172.128.0.16", "localhost", "[::]", "[2001:db8::fed1]"] # Default: "0.0.0.0" -bindAddress: "0.0.0.0" +bind-address: "0.0.0.0" # Int. Listen port for the GoToSocial webserver + API. If you're running behind a reverse proxy and/or in a docker, # container, just set this to whatever you like (or leave the default), and make sure it's forwarded properly. @@ -71,6 +71,6 @@ port: 8080 # or the gateway of the docker network, and/or the address of the reverse proxy (if it's not running on the host network). # Example: ["127.0.0.1/32", "172.20.0.1"] # Default: ["127.0.0.1/32"] (localhost) -trustedProxies: +trusted-proxies: - "127.0.0.1/32" ``` diff --git a/docs/configuration/index.md b/docs/configuration/index.md index ef27a0725..ed36505ec 100644 --- a/docs/configuration/index.md +++ b/docs/configuration/index.md @@ -4,8 +4,6 @@ GoToSocial aims to be as configurable as possible, to fit lots of different use We try to provide sensible defaults wherever possible, but you can't run a GoToSocial instance without managing *some* configuration. -In this section, we describe the different methods available for configuring GoToSocial, - ## Configuration Methods There are three different methods for configuring a GoToSocial instance, which can be combined depending on your setup. @@ -15,41 +13,39 @@ There are three different methods for configuring a GoToSocial instance, which c The easiest way to configure GoToSocial is to pass a configuration file to to the `gotosocial server start` command, for example: ```bash -gotosocial --config-path ./config.yaml server start +gotosocial server start --config-path ./config.yaml ``` -The command expects a file in [YAML](https://en.wikipedia.org/wiki/YAML) format. +The command expects a file in [YAML](https://en.wikipedia.org/wiki/YAML) or [JSON](https://en.wikipedia.org/wiki/JSON) format. 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). -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 is. +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. ### Environment Variables -You can also configure GoToSocial by setting [environment variables](https://en.wikipedia.org/wiki/Environment_variable). These environment variables generally follow the format: +You can also configure GoToSocial by setting [environment variables](https://en.wikipedia.org/wiki/Environment_variable). These environment variables follow the format: -```text -GTS_[CONFIG_SECTION]_[FIELD_NAME] -``` +1. Prepend `GTS_` to the config flag. +2. Uppercase-all. +3. Replace dash (`-`) with underscore (`_`). -So for example, instead of setting `media.maxImageSize` to `2097152` in your config.yaml, you could set the environment variable: +So for example, instead of setting `media-image-max-size` to `2097152` in your config.yaml, you could set the environment variable: ```text -GTS_MEDIA_MAX_IMAGE_SIZE=2097152 +GTS_MEDIA_IMAGE_MAX_SIZE=2097152 ``` -If you're in doubt about any of the names of these environment variables, just check `gotosocial --help`. They're all listed there. +If you're in doubt about any of the names of these environment variables, just check the `--help` for the subcommand you're using. ### Command Line Flags -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.maxImageSize` in your config.yaml, or with an environment variable, you can pass the value directly through the command line: +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: ```bash -gotosocial --media-max-image-size 2097152 server start +gotosocial server start --media-image-max-size 2097152 ``` -Note the weird order of the above command; `gotosocial` first, then all global variables (like the ones in the config.yaml), then the command you want to execute. - If you're in doubt about which flags are available, check `gotosocial --help`. ## Priority @@ -60,9 +56,9 @@ The above configuration methods override each other in the order in which they w command line flags > environment variables > config file ``` -That is, if you set `media.maxImageSize` 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. +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. -Command line flags have the highest priority, so if you set `--media-max-image-size 13121312`, then the final value will be `13121312` regardless of what you've set elsewhere. +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. 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. diff --git a/docs/configuration/letsencrypt.md b/docs/configuration/letsencrypt.md index 05953cbb7..4e3a6d59b 100644 --- a/docs/configuration/letsencrypt.md +++ b/docs/configuration/letsencrypt.md @@ -8,36 +8,35 @@ ############################## # Config pertaining to the automatic acquisition and use of LetsEncrypt HTTPS certificates. -letsEncrypt: - # Bool. Whether or not letsencrypt should be enabled for the server. - # If false, the rest of the settings here will be ignored. - # You should only change this if you want to serve GoToSocial behind a reverse proxy - # like Traefik, HAProxy, or Nginx. - # Options: [true, false] - # Default: true - enabled: true +# Bool. Whether or not letsencrypt should be enabled for the server. +# If false, the rest of the settings here will be ignored. +# You should only change this if you want to serve GoToSocial behind a reverse proxy +# like Traefik, HAProxy, or Nginx. +# Options: [true, false] +# Default: true +letsencrypt-enabled: true - # Int. Port to listen for letsencrypt certificate challenges on. - # If letsencrypt is enabled, this port must be reachable or you won't be able to obtain certs. - # If letsencrypt is disabled, this port will not be used. - # This *must not* be the same as the webserver/API port specified above. - # Examples: [80, 8000, 1312] - # Default: 80 - port: 80 +# Int. Port to listen for letsencrypt certificate challenges on. +# If letsencrypt is enabled, this port must be reachable or you won't be able to obtain certs. +# If letsencrypt is disabled, this port will not be used. +# This *must not* be the same as the webserver/API port specified above. +# Examples: [80, 8000, 1312] +# Default: 80 +letsencrypt-port: 80 - # String. Directory in which to store LetsEncrypt certificates. - # It is a good move to make this a sub-path within your storage directory, as it makes - # backup easier, but you might wish to move them elsewhere if they're also accessed by other services. - # In any case, make sure GoToSocial has permissions to write to / read from this directory. - # Examples: ["/home/gotosocial/storage/certs", "/acmecerts"] - # Default: "/gotosocial/storage/certs" - certDir: "/gotosocial/storage/certs" +# String. Directory in which to store LetsEncrypt certificates. +# It is a good move to make this a sub-path within your storage directory, as it makes +# backup easier, but you might wish to move them elsewhere if they're also accessed by other services. +# In any case, make sure GoToSocial has permissions to write to / read from this directory. +# Examples: ["/home/gotosocial/storage/certs", "/acmecerts"] +# Default: "/gotosocial/storage/certs" +letsencrypt-cert-dir: "/gotosocial/storage/certs" - # String. Email address to use when registering LetsEncrypt certs. - # Most likely, this will be the email address of the instance administrator. - # LetsEncrypt will send notifications about expiring certificates etc to this address. - # Examples: ["admin@example.org"] - # Default: "" - emailAddress: "" +# String. Email address to use when registering LetsEncrypt certs. +# Most likely, this will be the email address of the instance administrator. +# LetsEncrypt will send notifications about expiring certificates etc to this address. +# Examples: ["admin@example.org"] +# Default: "" +letsencrypt-email-address: "" ``` diff --git a/docs/configuration/media.md b/docs/configuration/media.md index 2c5e778f7..393274726 100644 --- a/docs/configuration/media.md +++ b/docs/configuration/media.md @@ -8,25 +8,24 @@ ######################## # Config pertaining to user media uploads (videos, image, image descriptions). -media: - # Int. Maximum allowed image upload size in bytes. - # Examples: [2097152, 10485760] - # Default: 2097152 -- aka 2MB - maxImageSize: 2097152 +# Int. Maximum allowed image upload size in bytes. +# Examples: [2097152, 10485760] +# Default: 2097152 -- aka 2MB +media-image-max-size: 2097152 - # Int. Maximum allowed video upload size in bytes. - # Examples: [2097152, 10485760] - # Default: 10485760 -- aka 10MB - maxVideoSize: 10485760 +# Int. Maximum allowed video upload size in bytes. +# Examples: [2097152, 10485760] +# Default: 10485760 -- aka 10MB +media-video-max-size: 10485760 - # Int. Minimum amount of characters required as an image or video description. - # Examples: [500, 1000, 1500] - # Default: 0 (not required) - minDescriptionChars: 0 +# Int. Minimum amount of characters required as an image or video description. +# Examples: [500, 1000, 1500] +# Default: 0 (not required) +media-description-min-chars: 0 - # Int. Maximum amount of characters permitted in an image or video description. - # Examples: [500, 1000, 1500] - # Default: 500 - maxDescriptionChars: 500 +# Int. Maximum amount of characters permitted in an image or video description. +# Examples: [500, 1000, 1500] +# Default: 500 +media-description-max-chars: 500 ``` diff --git a/docs/configuration/oidc.md b/docs/configuration/oidc.md index 6c6bbe94b..e373e48d9 100644 --- a/docs/configuration/oidc.md +++ b/docs/configuration/oidc.md @@ -20,55 +20,54 @@ GoToSocial exposes the following configuration settings for OIDC, shown below wi ####################### # Config for authentication with an external OIDC provider (Dex, Google, Auth0, etc). -oidc: - - # Bool. Enable authentication with external OIDC provider. If set to true, then - # the other OIDC options must be set as well. If this is set to false, then the standard - # internal oauth flow will be used, where users sign in to GtS with username/password. - # Options: [true, false] - # Default: false - enabled: false - - # String. Name of the oidc idp (identity provider). This will be shown to users when - # they log in. - # Examples: ["Google", "Dex", "Auth0"] - # Default: "" - idpName: "" - - # Bool. Skip the normal verification flow of tokens returned from the OIDC provider, ie., - # don't check the expiry or signature. This should only be used in debugging or testing, - # never ever in a production environment as it's extremely unsafe! - # Options: [true, false] - # Default: false - skipVerification: false - # String. The OIDC issuer URI. This is where GtS will redirect users to for login. - # Typically this will look like a standard web URL. - # Examples: ["https://auth.example.org", "https://example.org/auth"] - # Default: "" - issuer: "" - - # String. The ID for this client as registered with the OIDC provider. - # Examples: ["some-client-id", "fda3772a-ad35-41c9-9a59-f1943ad18f54"] - # Default: "" - clientID: "" - - # String. The secret for this client as registered with the OIDC provider. - # Examples: ["super-secret-business", "79379cf5-8057-426d-bb83-af504d98a7b0"] - # Default: "" - clientSecret: "" - - # Array of string. Scopes to request from the OIDC provider. The returned values will be used to - # populate users created in GtS as a result of the authentication flow. 'openid' and 'email' are required. - # 'profile' is used to extract a username for the newly created user. - # 'groups' is optional and can be used to determine if a user is an admin (if they're in the group 'admin' or 'admins'). - # Examples: See eg., https://auth0.com/docs/scopes/openid-connect-scopes - # Default: ["openid", "email", "profile", "groups"] - scopes: - - "openid" - - "email" - - "profile" - - "groups" +# Bool. Enable authentication with external OIDC provider. If set to true, then +# the other OIDC options must be set as well. If this is set to false, then the standard +# internal oauth flow will be used, where users sign in to GtS with username/password. +# Options: [true, false] +# Default: false +oidc-enabled: false + +# String. Name of the oidc idp (identity provider). This will be shown to users when +# they log in. +# Examples: ["Google", "Dex", "Auth0"] +# Default: "" +oidc-idp-name: "" + +# Bool. Skip the normal verification flow of tokens returned from the OIDC provider, ie., +# don't check the expiry or signature. This should only be used in debugging or testing, +# never ever in a production environment as it's extremely unsafe! +# Options: [true, false] +# Default: false +oidc-skip-verification: false + +# String. The OIDC issuer URI. This is where GtS will redirect users to for login. +# Typically this will look like a standard web URL. +# Examples: ["https://auth.example.org", "https://example.org/auth"] +# Default: "" +oidc-issuer: "" + +# String. The ID for this client as registered with the OIDC provider. +# Examples: ["some-client-id", "fda3772a-ad35-41c9-9a59-f1943ad18f54"] +# Default: "" +oidc-client-id: "" + +# String. The secret for this client as registered with the OIDC provider. +# Examples: ["super-secret-business", "79379cf5-8057-426d-bb83-af504d98a7b0"] +# Default: "" +oidc-client-secret: "" + +# Array of string. Scopes to request from the OIDC provider. The returned values will be used to +# populate users created in GtS as a result of the authentication flow. 'openid' and 'email' are required. +# 'profile' is used to extract a username for the newly created user. +# 'groups' is optional and can be used to determine if a user is an admin (if they're in the group 'admin' or 'admins'). +# Examples: See eg., https://auth0.com/docs/scopes/openid-connect-scopes +# Default: ["openid", "email", "profile", "groups"] +oidc-scopes: + - "openid" + - "email" + - "profile" + - "groups" ``` ## Behavior diff --git a/docs/configuration/smtp.md b/docs/configuration/smtp.md index d191be3c8..b87847abd 100644 --- a/docs/configuration/smtp.md +++ b/docs/configuration/smtp.md @@ -16,32 +16,35 @@ The configuration options for smtp are as follows: ####################### # Config for sending emails via an smtp server. See https://en.wikipedia.org/wiki/Simple_Mail_Transfer_Protocol -smtp: - - # String. The hostname of the smtp server you want to use. - # If this is not set, smtp will not be used to send emails, and you can ignore the other settings. - # Examples: ["mail.example.org", "localhost"] - # Default: "" - host: "" - # Int. Port to use to connect to the smtp server. - # Examples: [] - # Default: 0 - port: 0 - # String. Username to use when authenticating with the smtp server. - # This should have been provided to you by your smtp host. - # This is often, but not always, an email address. - # Examples: ["maillord@example.org"] - # Default: "" - username: - # String. Password to use when authenticating with the smtp server. - # This should have been provided to you by your smtp host. - # Examples: ["1234", "password"] - # Default: "" - password: - # String. 'From' address for sent emails. - # Examples: ["mail@example.org"] - # Default: "" - from: "" + +# String. The hostname of the smtp server you want to use. +# If this is not set, smtp will not be used to send emails, and you can ignore the other settings. +# Examples: ["mail.example.org", "localhost"] +# Default: "" +smtp-host: "" + +# Int. Port to use to connect to the smtp server. +# Examples: [] +# Default: 0 +smtp-port: 0 + +# String. Username to use when authenticating with the smtp server. +# This should have been provided to you by your smtp host. +# This is often, but not always, an email address. +# Examples: ["maillord@example.org"] +# Default: "" +smtp-username: "" + +# String. Password to use when authenticating with the smtp server. +# This should have been provided to you by your smtp host. +# Examples: ["1234", "password"] +# Default: "" +smtp-password: "" + +# String. 'From' address for sent emails. +# Examples: ["mail@example.org"] +# Default: "" +smtp-from: "" ``` Note that if you don't set `Host`, then email sending via smtp will be disabled, and the other settings will be ignored. GoToSocial will still log (at trace level) emails that *would* have been sent if smtp was enabled. diff --git a/docs/configuration/statuses.md b/docs/configuration/statuses.md index 606776a83..e0348dd5a 100644 --- a/docs/configuration/statuses.md +++ b/docs/configuration/statuses.md @@ -3,43 +3,39 @@ ## Settings ```yaml -########################## -##### STORAGE CONFIG ##### -########################## - -# Config pertaining to storage of user-created uploads (videos, images, etc). -storage: - - # String. Type of storage backend to use. - # Examples: ["local", "s3"] - # Default: "local" (storage on local disk) - # NOTE: s3 storage is not yet supported! - backend: "local" - - # String. Directory to use as a base path for storing files. - # Make sure whatever user/group gotosocial is running as has permission to access - # this directly, and create new subdirectories and files with in. - # Examples: ["/home/gotosocial/storage", "/opt/gotosocial/datastorage"] - # Default: "/gotosocial/storage" - basePath: "/gotosocial/storage" - - # String. Protocol to use for serving stored files. - # It's very unlikely that you'll need to change this ever, but there might be edge cases. - # Examples: ["http", "https"] - serveProtocol: "https" - - # String. Host for serving stored files. - # If you're using local storage, this should be THE SAME as the value you've set for Host, above. - # It should only be a different value if you're serving stored files from a host - # other than the one your instance is running on. - # Examples: ["localhost", "example.org"] - # Default: "localhost" -- you should absolutely change this. - serveHost: "localhost" - - # String. Base path for serving stored files. This will be added to serveHost and serveProtocol - # to form the prefix url of your stored files. Eg., https://example.org/fileserver/..... - # It's unlikely that you will need to change this. - # Examples: ["/fileserver", "/media"] - # Default: "/fileserver" - serveBasePath: "/fileserver" +########################### +##### STATUSES CONFIG ##### +########################### + +# Config pertaining to the creation of statuses/posts, and permitted limits. + +# Int. Maximum amount of characters permitted for a new status. +# Note that going way higher than the default might break federation. +# Examples: [140, 500, 5000] +# Default: 5000 +statuses-max-chars: 5000 + +# Int. Maximum amount of characters allowed in the CW/subject header of a status. +# Note that going way higher than the default might break federation. +# Examples: [100, 200] +# Default: 100 +statuses-cw-max-chars: 100 + +# Int. Maximum amount of options to permit when creating a new poll. +# Note that going way higher than the default might break federation. +# Examples: [4, 6, 10] +# Default: 6 +statuses-poll-max-options: 6 + +# Int. Maximum amount of characters to permit per poll option when creating a new poll. +# Note that going way higher than the default might break federation. +# Examples: [50, 100, 150] +# Default: 50 +statuses-poll-option-max-chars: 50 + +# Int. Maximum amount of media files that can be attached to a new status. +# Note that going way higher than the default might break federation. +# Examples: [4, 6, 10] +# Default: 6 +statuses-media-max-files: 6 ``` diff --git a/docs/configuration/storage.md b/docs/configuration/storage.md index f62d59581..b0fadcd4c 100644 --- a/docs/configuration/storage.md +++ b/docs/configuration/storage.md @@ -8,38 +8,37 @@ ########################## # Config pertaining to storage of user-created uploads (videos, images, etc). -storage: - - # String. Type of storage backend to use. - # Examples: ["local", "s3"] - # Default: "local" (storage on local disk) - # NOTE: s3 storage is not yet supported! - backend: "local" - - # String. Directory to use as a base path for storing files. - # Make sure whatever user/group gotosocial is running as has permission to access - # this directly, and create new subdirectories and files with in. - # Examples: ["/home/gotosocial/storage", "/opt/gotosocial/datastorage"] - # Default: "/gotosocial/storage" - basePath: "/gotosocial/storage" - - # String. Protocol to use for serving stored files. - # It's very unlikely that you'll need to change this ever, but there might be edge cases. - # Examples: ["http", "https"] - serveProtocol: "https" - - # String. Host for serving stored files. - # If you're using local storage, this should be THE SAME as the value you've set for Host, above. - # It should only be a different value if you're serving stored files from a host - # other than the one your instance is running on. - # Examples: ["localhost", "example.org"] - # Default: "localhost" -- you should absolutely change this. - serveHost: "localhost" - - # String. Base path for serving stored files. This will be added to serveHost and serveProtocol - # to form the prefix url of your stored files. Eg., https://example.org/fileserver/..... - # It's unlikely that you will need to change this. - # Examples: ["/fileserver", "/media"] - # Default: "/fileserver" - serveBasePath: "/fileserver" -```
\ No newline at end of file + +# String. Type of storage backend to use. +# Examples: ["local", "s3"] +# Default: "local" (storage on local disk) +# NOTE: s3 storage is not yet supported! +storage-backend: "local" + +# String. Directory to use as a base path for storing files. +# Make sure whatever user/group gotosocial is running as has permission to access +# this directly, and create new subdirectories and files with in. +# Examples: ["/home/gotosocial/storage", "/opt/gotosocial/datastorage"] +# Default: "/gotosocial/storage" +storage-base-path: "/gotosocial/storage" + +# String. Protocol to use for serving stored files. +# It's very unlikely that you'll need to change this ever, but there might be edge cases. +# Examples: ["http", "https"] +storage-serve-protocol: "https" + +# String. Host for serving stored files. +# If you're using local storage, this should be THE SAME as the value you've set for Host, above. +# It should only be a different value if you're serving stored files from a host +# other than the one your instance is running on. +# Examples: ["localhost", "example.org"] +# Default: "localhost" -- you should absolutely change this. +storage-serve-host: "localhost" + +# String. Base path for serving stored files. This will be added to serveHost and serveProtocol +# to form the prefix url of your stored files. Eg., https://example.org/fileserver/..... +# It's unlikely that you will need to change this. +# Examples: ["/fileserver", "/media"] +# Default: "/fileserver" +storage-serve-base-path: "/fileserver" +``` diff --git a/docs/configuration/template.md b/docs/configuration/template.md deleted file mode 100644 index 2c0fd5a61..000000000 --- a/docs/configuration/template.md +++ /dev/null @@ -1,22 +0,0 @@ -# Template - -## Settings - -```yaml -############################### -##### WEB TEMPLATE CONFIG ##### -############################### - -# Config pertaining to templating of web pages/email notifications and the like -template: - - # String. Directory from which gotosocial will attempt to load html templates (.tmpl files). - # Examples: ["/some/absolute/path/", "./relative/path/", "../../some/weird/path/"] - # Default: "./web/template/" - baseDir: "./web/template/" - - # String. Directory from which gotosocial will attempt to serve static web assets (images, scripts). - # Examples: ["/some/absolute/path/", "./relative/path/", "../../some/weird/path/"] - # Default: "./web/assets/" - assetBaseDir: "./web/assets/" -``` diff --git a/docs/configuration/web.md b/docs/configuration/web.md new file mode 100644 index 000000000..99533a287 --- /dev/null +++ b/docs/configuration/web.md @@ -0,0 +1,21 @@ +# Web + +## Settings + +```yaml +###################### +##### WEB CONFIG ##### +###################### + +# Config pertaining to templating and serving of web pages/email notifications and the like + +# String. Directory from which gotosocial will attempt to load html templates (.tmpl files). +# Examples: ["/some/absolute/path/", "./relative/path/", "../../some/weird/path/"] +# Default: "./web/template/" +web-template-base-dir: "./web/template/" + +# String. Directory from which gotosocial will attempt to serve static web assets (images, scripts). +# Examples: ["/some/absolute/path/", "./relative/path/", "../../some/weird/path/"] +# Default: "./web/assets/" +web-asset-base-dir: "./web/assets/" +``` diff --git a/docs/installation_guide/binary.md b/docs/installation_guide/binary.md index 7668999d3..576dc52b3 100644 --- a/docs/installation_guide/binary.md +++ b/docs/installation_guide/binary.md @@ -63,7 +63,7 @@ You can now run the binary. Start the GoToSocial server with the following command: ```bash -./gotosocial --config-path ./config.yaml server start +./gotosocial server start --config-path ./config.yaml ``` The server should now start up and you should be able to access the splash page by navigating to your domain in the browser. Note that it might take up to a minute or so for your LetsEncrypt certificates to be created for the first time, so refresh a few times if necessary. @@ -77,7 +77,7 @@ You can use the GoToSocial binary to also create, confirm, and promote your user Run the following command to create a new account: ```bash -./gotosocial --config-path ./config.yaml admin account create --username some_username --email some_email@whatever.org --password SOME_PASSWORD +./gotosocial admin account create --config-path ./config.yaml --username some_username --email some_email@whatever.org --password SOME_PASSWORD ``` In the above command, replace `some_username` with your desired username, `some_email@whatever.org` with the email address you want to associate with your account, and `SOME_PASSWORD` with a secure password. @@ -85,7 +85,7 @@ In the above command, replace `some_username` with your desired username, `some_ Run the following command to confirm the account you just created: ```bash -./gotosocial --config-path ./config.yaml admin account confirm --username some_username +./gotosocial admin account confirm --config-path ./config.yaml --username some_username ``` Replace `some_username` with the username of the account you just created. @@ -93,7 +93,7 @@ Replace `some_username` with the username of the account you just created. If you want your user to have admin rights, you can promote them using a similar command: ```bash -./gotosocial --config-path ./config.yaml admin account promote --username some_username +./gotosocial admin account promote --config-path ./config.yaml --username some_username ``` Replace `some_username` with the username of the account you just created. diff --git a/docs/installation_guide/index.md b/docs/installation_guide/index.md index 34b7903b1..b28deb7ff 100644 --- a/docs/installation_guide/index.md +++ b/docs/installation_guide/index.md @@ -16,7 +16,7 @@ If you decide to use a VPS instead, you can just spin yourself up something chea [Greenhost](https://greenhost.net) is also great: it has zero co2 emissions, but is a bit more costly. -## Ports +## Ports The installation guides won't go into running [UFW](https://www.digitalocean.com/community/tutorials/how-to-set-up-a-firewall-with-ufw-on-ubuntu-18-04) and [Fail2Ban](https://linuxize.com/post/install-configure-fail2ban-on-ubuntu-20-04/) but you absolutely should do that. |