2022-06-08 20:28:28 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -eu
|
|
|
|
|
2023-08-03 11:34:35 +02:00
|
|
|
EXPECT=$(cat << "EOF"
|
2023-03-04 21:56:50 +01:00
|
|
|
{
|
|
|
|
"account-domain": "peepee",
|
|
|
|
"accounts-allow-custom-css": true,
|
2023-05-25 15:18:15 +02:00
|
|
|
"accounts-custom-css-length": 5000,
|
2023-03-04 21:56:50 +01:00
|
|
|
"accounts-reason-required": false,
|
|
|
|
"accounts-registration-open": true,
|
|
|
|
"advanced-cookies-samesite": "strict",
|
2023-08-20 13:35:55 +02:00
|
|
|
"advanced-csp-extra-uris": [],
|
2023-12-18 15:18:25 +01:00
|
|
|
"advanced-header-filter-mode": "",
|
2023-08-23 14:32:27 +02:00
|
|
|
"advanced-rate-limit-exceptions": [
|
|
|
|
"192.0.2.0/24",
|
|
|
|
"127.0.0.1/32"
|
|
|
|
],
|
2023-03-04 21:56:50 +01:00
|
|
|
"advanced-rate-limit-requests": 6969,
|
2023-05-08 19:03:38 +02:00
|
|
|
"advanced-sender-multiplier": -1,
|
2023-03-04 21:56:50 +01:00
|
|
|
"advanced-throttling-multiplier": -1,
|
|
|
|
"advanced-throttling-retry-after": 10000000000,
|
|
|
|
"application-name": "gts",
|
|
|
|
"bind-address": "127.0.0.1",
|
|
|
|
"cache": {
|
2023-08-14 18:08:19 +02:00
|
|
|
"account-mem-ratio": 5,
|
|
|
|
"account-note-mem-ratio": 1,
|
2024-03-22 14:03:46 +01:00
|
|
|
"account-settings-mem-ratio": 0.1,
|
2024-04-16 13:10:13 +02:00
|
|
|
"account-stats-mem-ratio": 2,
|
2023-08-10 16:08:41 +02:00
|
|
|
"application-mem-ratio": 0.1,
|
2023-08-03 11:34:35 +02:00
|
|
|
"block-mem-ratio": 3,
|
2023-08-04 13:28:33 +02:00
|
|
|
"boost-of-ids-mem-ratio": 3,
|
2024-04-15 15:22:21 +02:00
|
|
|
"client-mem-ratio": 0.1,
|
2023-08-03 11:34:35 +02:00
|
|
|
"emoji-category-mem-ratio": 0.1,
|
|
|
|
"emoji-mem-ratio": 3,
|
2024-03-06 11:15:58 +01:00
|
|
|
"filter-keyword-mem-ratio": 0.5,
|
|
|
|
"filter-mem-ratio": 0.5,
|
|
|
|
"filter-status-mem-ratio": 0.5,
|
2023-08-03 11:34:35 +02:00
|
|
|
"follow-ids-mem-ratio": 4,
|
2023-08-14 18:08:19 +02:00
|
|
|
"follow-mem-ratio": 2,
|
2023-08-03 11:34:35 +02:00
|
|
|
"follow-request-ids-mem-ratio": 2,
|
|
|
|
"follow-request-mem-ratio": 2,
|
2023-08-04 13:28:33 +02:00
|
|
|
"in-reply-to-ids-mem-ratio": 3,
|
2023-08-03 11:34:35 +02:00
|
|
|
"instance-mem-ratio": 1,
|
2023-08-14 18:08:19 +02:00
|
|
|
"list-entry-mem-ratio": 2,
|
|
|
|
"list-mem-ratio": 1,
|
2023-08-03 11:34:35 +02:00
|
|
|
"marker-mem-ratio": 0.5,
|
|
|
|
"media-mem-ratio": 4,
|
2023-08-14 18:08:19 +02:00
|
|
|
"memory-target": 104857600,
|
|
|
|
"mention-mem-ratio": 2,
|
2024-03-06 11:18:57 +01:00
|
|
|
"move-mem-ratio": 0.1,
|
2023-08-14 18:08:19 +02:00
|
|
|
"notification-mem-ratio": 2,
|
2023-11-08 15:32:17 +01:00
|
|
|
"poll-mem-ratio": 1,
|
|
|
|
"poll-vote-ids-mem-ratio": 2,
|
|
|
|
"poll-vote-mem-ratio": 2,
|
2023-08-03 11:34:35 +02:00
|
|
|
"report-mem-ratio": 1,
|
2023-08-04 13:28:33 +02:00
|
|
|
"status-fave-ids-mem-ratio": 3,
|
2023-08-14 18:08:19 +02:00
|
|
|
"status-fave-mem-ratio": 2,
|
|
|
|
"status-mem-ratio": 5,
|
|
|
|
"tag-mem-ratio": 2,
|
2023-10-25 16:04:53 +02:00
|
|
|
"thread-mute-mem-ratio": 0.2,
|
2024-04-15 15:22:21 +02:00
|
|
|
"token-mem-ratio": 0.75,
|
2023-08-14 18:08:19 +02:00
|
|
|
"tombstone-mem-ratio": 0.5,
|
2023-08-10 16:08:41 +02:00
|
|
|
"user-mem-ratio": 0.25,
|
2023-08-03 11:34:35 +02:00
|
|
|
"visibility-mem-ratio": 2,
|
|
|
|
"webfinger-mem-ratio": 0.1
|
2023-03-04 21:56:50 +01:00
|
|
|
},
|
|
|
|
"config-path": "internal/config/testdata/test.yaml",
|
|
|
|
"db-address": ":memory:",
|
|
|
|
"db-database": "gotosocial_prod",
|
|
|
|
"db-max-open-conns-multiplier": 3,
|
|
|
|
"db-password": "hunter2",
|
|
|
|
"db-port": 6969,
|
|
|
|
"db-sqlite-busy-timeout": 1000000000,
|
|
|
|
"db-sqlite-cache-size": 0,
|
|
|
|
"db-sqlite-journal-mode": "DELETE",
|
|
|
|
"db-sqlite-synchronous": "FULL",
|
|
|
|
"db-tls-ca-cert": "",
|
|
|
|
"db-tls-mode": "disable",
|
|
|
|
"db-type": "sqlite",
|
|
|
|
"db-user": "sex-haver",
|
|
|
|
"dry-run": true,
|
|
|
|
"email": "",
|
|
|
|
"host": "example.com",
|
2023-07-07 16:17:39 +02:00
|
|
|
"http-client": {
|
|
|
|
"allow-ips": [],
|
|
|
|
"block-ips": [],
|
2023-08-01 19:50:17 +02:00
|
|
|
"timeout": 10000000000,
|
|
|
|
"tls-insecure-skip-verify": false
|
2023-07-07 16:17:39 +02:00
|
|
|
},
|
2023-03-04 21:56:50 +01:00
|
|
|
"instance-deliver-to-shared-inboxes": false,
|
|
|
|
"instance-expose-peers": true,
|
|
|
|
"instance-expose-public-timeline": true,
|
|
|
|
"instance-expose-suspended": true,
|
|
|
|
"instance-expose-suspended-web": true,
|
2023-09-21 12:12:04 +02:00
|
|
|
"instance-federation-mode": "allowlist",
|
2024-02-27 13:22:05 +01:00
|
|
|
"instance-federation-spam-filter": true,
|
2023-07-21 19:49:13 +02:00
|
|
|
"instance-inject-mastodon-version": true,
|
2023-11-17 11:35:28 +01:00
|
|
|
"instance-languages": [
|
|
|
|
"nl",
|
|
|
|
"en-GB"
|
|
|
|
],
|
2023-03-04 21:56:50 +01:00
|
|
|
"landing-page-user": "admin",
|
|
|
|
"letsencrypt-cert-dir": "/gotosocial/storage/certs",
|
|
|
|
"letsencrypt-email-address": "",
|
|
|
|
"letsencrypt-enabled": true,
|
|
|
|
"letsencrypt-port": 80,
|
2023-08-23 18:01:16 +02:00
|
|
|
"local-only": false,
|
2023-05-21 17:12:47 +02:00
|
|
|
"log-client-ip": false,
|
2023-03-04 21:56:50 +01:00
|
|
|
"log-db-queries": true,
|
|
|
|
"log-level": "info",
|
2023-08-21 20:07:55 +02:00
|
|
|
"log-timestamp-format": "banana",
|
2023-10-30 18:35:11 +01:00
|
|
|
"media-cleanup-every": 86400000000000,
|
|
|
|
"media-cleanup-from": "00:00",
|
2023-03-04 21:56:50 +01:00
|
|
|
"media-description-max-chars": 5000,
|
|
|
|
"media-description-min-chars": 69,
|
|
|
|
"media-emoji-local-max-size": 420,
|
|
|
|
"media-emoji-remote-max-size": 420,
|
|
|
|
"media-image-max-size": 420,
|
|
|
|
"media-remote-cache-days": 30,
|
|
|
|
"media-video-max-size": 420,
|
2023-11-20 16:43:55 +01:00
|
|
|
"metrics-auth-enabled": false,
|
|
|
|
"metrics-auth-password": "",
|
|
|
|
"metrics-auth-username": "",
|
|
|
|
"metrics-enabled": false,
|
2023-03-04 21:56:50 +01:00
|
|
|
"oidc-admin-groups": [
|
|
|
|
"steamy"
|
|
|
|
],
|
2024-02-27 16:07:29 +01:00
|
|
|
"oidc-allowed-groups": [
|
|
|
|
"sloths"
|
|
|
|
],
|
2023-03-04 21:56:50 +01:00
|
|
|
"oidc-client-id": "1234",
|
|
|
|
"oidc-client-secret": "shhhh its a secret",
|
|
|
|
"oidc-enabled": true,
|
|
|
|
"oidc-idp-name": "sex-haver",
|
|
|
|
"oidc-issuer": "whoknows",
|
|
|
|
"oidc-link-existing": true,
|
|
|
|
"oidc-scopes": [
|
|
|
|
"read",
|
|
|
|
"write"
|
|
|
|
],
|
|
|
|
"oidc-skip-verification": true,
|
|
|
|
"password": "",
|
|
|
|
"path": "",
|
|
|
|
"port": 6969,
|
|
|
|
"protocol": "http",
|
2023-08-23 18:01:16 +02:00
|
|
|
"remote-only": false,
|
2023-03-04 21:56:50 +01:00
|
|
|
"request-id-header": "X-Trace-Id",
|
2023-03-19 13:11:46 +01:00
|
|
|
"smtp-disclose-recipients": true,
|
2023-03-04 21:56:50 +01:00
|
|
|
"smtp-from": "queen.rip.in.piss@terfisland.org",
|
|
|
|
"smtp-host": "example.com",
|
|
|
|
"smtp-password": "hunter2",
|
|
|
|
"smtp-port": 4269,
|
|
|
|
"smtp-username": "sex-haver",
|
|
|
|
"software-version": "",
|
|
|
|
"statuses-max-chars": 69,
|
|
|
|
"statuses-media-max-files": 1,
|
|
|
|
"statuses-poll-max-options": 1,
|
|
|
|
"statuses-poll-option-max-chars": 50,
|
|
|
|
"storage-backend": "local",
|
|
|
|
"storage-local-base-path": "/root/store",
|
|
|
|
"storage-s3-access-key": "minio",
|
|
|
|
"storage-s3-bucket": "gts",
|
|
|
|
"storage-s3-endpoint": "localhost:9000",
|
|
|
|
"storage-s3-proxy": true,
|
|
|
|
"storage-s3-secret-key": "miniostorage",
|
|
|
|
"storage-s3-use-ssl": false,
|
|
|
|
"syslog-address": "127.0.0.1:6969",
|
|
|
|
"syslog-enabled": true,
|
|
|
|
"syslog-protocol": "udp",
|
|
|
|
"tls-certificate-chain": "",
|
|
|
|
"tls-certificate-key": "",
|
2023-05-09 19:19:48 +02:00
|
|
|
"tracing-enabled": false,
|
|
|
|
"tracing-endpoint": "localhost:4317",
|
2023-09-07 13:20:37 +02:00
|
|
|
"tracing-insecure-transport": true,
|
2023-05-09 19:19:48 +02:00
|
|
|
"tracing-transport": "grpc",
|
2023-03-04 21:56:50 +01:00
|
|
|
"trusted-proxies": [
|
|
|
|
"127.0.0.1/32",
|
|
|
|
"docker.host.local"
|
|
|
|
],
|
|
|
|
"username": "",
|
|
|
|
"web-asset-base-dir": "/root",
|
|
|
|
"web-template-base-dir": "/root"
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
)
|
2022-06-08 20:28:28 +02:00
|
|
|
|
|
|
|
# Set all the environment variables to
|
|
|
|
# ensure that these are parsed without panic
|
|
|
|
OUTPUT=$(GTS_LOG_LEVEL='info' \
|
2023-08-21 20:07:55 +02:00
|
|
|
GTS_LOG_TIMESTAMP_FORMAT="banana" \
|
2022-06-08 20:28:28 +02:00
|
|
|
GTS_LOG_DB_QUERIES=true \
|
2023-05-21 17:12:47 +02:00
|
|
|
GTS_LOG_CLIENT_IP=false \
|
2022-06-08 20:28:28 +02:00
|
|
|
GTS_APPLICATION_NAME=gts \
|
2022-11-03 13:15:31 +01:00
|
|
|
GTS_LANDING_PAGE_USER=admin \
|
2022-06-08 20:28:28 +02:00
|
|
|
GTS_HOST=example.com \
|
|
|
|
GTS_ACCOUNT_DOMAIN='peepee' \
|
|
|
|
GTS_PROTOCOL=http \
|
|
|
|
GTS_BIND_ADDRESS='127.0.0.1' \
|
|
|
|
GTS_PORT=6969 \
|
2022-09-29 17:08:56 +02:00
|
|
|
GTS_TRUSTED_PROXIES='127.0.0.1/32,docker.host.local' \
|
2022-06-08 20:28:28 +02:00
|
|
|
GTS_DB_TYPE='sqlite' \
|
|
|
|
GTS_DB_ADDRESS=':memory:' \
|
|
|
|
GTS_DB_PORT=6969 \
|
|
|
|
GTS_DB_USER='sex-haver' \
|
|
|
|
GTS_DB_PASSWORD='hunter2' \
|
|
|
|
GTS_DB_DATABASE='gotosocial_prod' \
|
2023-01-26 15:12:48 +01:00
|
|
|
GTS_DB_MAX_OPEN_CONNS_MULTIPLIER=3 \
|
2023-01-17 13:29:44 +01:00
|
|
|
GTS_DB_SQLITE_JOURNAL_MODE='DELETE' \
|
|
|
|
GTS_DB_SQLITE_SYNCHRONOUS='FULL' \
|
|
|
|
GTS_DB_SQLITE_CACHE_SIZE=0 \
|
|
|
|
GTS_DB_SQLITE_BUSY_TIMEOUT='1s' \
|
2022-06-08 20:28:28 +02:00
|
|
|
GTS_TLS_MODE='' \
|
|
|
|
GTS_DB_TLS_CA_CERT='' \
|
|
|
|
GTS_WEB_TEMPLATE_BASE_DIR='/root' \
|
|
|
|
GTS_WEB_ASSET_BASE_DIR='/root' \
|
2022-06-23 16:54:54 +02:00
|
|
|
GTS_INSTANCE_EXPOSE_PEERS=true \
|
|
|
|
GTS_INSTANCE_EXPOSE_SUSPENDED=true \
|
2023-01-25 18:06:41 +01:00
|
|
|
GTS_INSTANCE_EXPOSE_SUSPENDED_WEB=true \
|
2022-11-14 10:30:01 +01:00
|
|
|
GTS_INSTANCE_EXPOSE_PUBLIC_TIMELINE=true \
|
2023-09-21 12:12:04 +02:00
|
|
|
GTS_INSTANCE_FEDERATION_MODE='allowlist' \
|
2024-02-27 13:22:05 +01:00
|
|
|
GTS_INSTANCE_FEDERATION_SPAM_FILTER=true \
|
2022-09-23 21:27:35 +02:00
|
|
|
GTS_INSTANCE_DELIVER_TO_SHARED_INBOXES=false \
|
2023-07-21 19:49:13 +02:00
|
|
|
GTS_INSTANCE_INJECT_MASTODON_VERSION=true \
|
2023-11-17 11:35:28 +01:00
|
|
|
GTS_INSTANCE_LANGUAGES="nl,en-gb" \
|
2022-09-12 13:14:29 +02:00
|
|
|
GTS_ACCOUNTS_ALLOW_CUSTOM_CSS=true \
|
2023-05-25 15:18:15 +02:00
|
|
|
GTS_ACCOUNTS_CUSTOM_CSS_LENGTH=5000 \
|
2022-06-08 20:28:28 +02:00
|
|
|
GTS_ACCOUNTS_REGISTRATION_OPEN=true \
|
|
|
|
GTS_ACCOUNTS_REASON_REQUIRED=false \
|
|
|
|
GTS_MEDIA_IMAGE_MAX_SIZE=420 \
|
|
|
|
GTS_MEDIA_VIDEO_MAX_SIZE=420 \
|
|
|
|
GTS_MEDIA_DESCRIPTION_MIN_CHARS=69 \
|
|
|
|
GTS_MEDIA_DESCRIPTION_MAX_CHARS=5000 \
|
|
|
|
GTS_MEDIA_REMOTE_CACHE_DAYS=30 \
|
2022-09-12 13:03:23 +02:00
|
|
|
GTS_MEDIA_EMOJI_LOCAL_MAX_SIZE=420 \
|
|
|
|
GTS_MEDIA_EMOJI_REMOTE_MAX_SIZE=420 \
|
2023-11-20 16:43:55 +01:00
|
|
|
GTS_METRICS_AUTH_ENABLED=false \
|
|
|
|
GTS_METRICS_ENABLED=false \
|
2022-06-08 20:28:28 +02:00
|
|
|
GTS_STORAGE_BACKEND='local' \
|
|
|
|
GTS_STORAGE_LOCAL_BASE_PATH='/root/store' \
|
2022-07-03 12:08:30 +02:00
|
|
|
GTS_STORAGE_S3_ACCESS_KEY='minio' \
|
|
|
|
GTS_STORAGE_S3_SECRET_KEY='miniostorage' \
|
|
|
|
GTS_STORAGE_S3_ENDPOINT='localhost:9000' \
|
|
|
|
GTS_STORAGE_S3_USE_SSL='false' \
|
2022-11-11 12:03:18 +01:00
|
|
|
GTS_STORAGE_S3_PROXY='true' \
|
2022-07-03 12:08:30 +02:00
|
|
|
GTS_STORAGE_S3_BUCKET='gts' \
|
2022-06-08 20:28:28 +02:00
|
|
|
GTS_STATUSES_MAX_CHARS=69 \
|
|
|
|
GTS_STATUSES_CW_MAX_CHARS=420 \
|
|
|
|
GTS_STATUSES_POLL_MAX_OPTIONS=1 \
|
|
|
|
GTS_STATUSES_POLL_OPTIONS_MAX_CHARS=69 \
|
|
|
|
GTS_STATUSES_MEDIA_MAX_FILES=1 \
|
|
|
|
GTS_LETS_ENCRYPT_ENABLED=false \
|
|
|
|
GTS_LETS_ENCRYPT_PORT=8080 \
|
|
|
|
GTS_LETS_ENCRYPT_CERT_DIR='/root/certs' \
|
|
|
|
GTS_LETS_ENCRYPT_EMAIL_ADDRESS='le@example.com' \
|
|
|
|
GTS_OIDC_ENABLED=true \
|
|
|
|
GTS_OIDC_IDP_NAME='sex-haver' \
|
|
|
|
GTS_OIDC_SKIP_VERIFICATION=true \
|
|
|
|
GTS_OIDC_ISSUER='whoknows' \
|
|
|
|
GTS_OIDC_CLIENT_ID='1234' \
|
|
|
|
GTS_OIDC_CLIENT_SECRET='shhhh its a secret' \
|
|
|
|
GTS_OIDC_SCOPES='read,write' \
|
2022-12-06 14:15:56 +01:00
|
|
|
GTS_OIDC_LINK_EXISTING=true \
|
2024-02-27 16:07:29 +01:00
|
|
|
GTS_OIDC_ALLOWED_GROUPS='sloths' \
|
2023-02-25 17:37:39 +01:00
|
|
|
GTS_OIDC_ADMIN_GROUPS='steamy' \
|
2022-06-08 20:28:28 +02:00
|
|
|
GTS_SMTP_HOST='example.com' \
|
|
|
|
GTS_SMTP_PORT=4269 \
|
|
|
|
GTS_SMTP_USERNAME='sex-haver' \
|
|
|
|
GTS_SMTP_PASSWORD='hunter2' \
|
2022-09-29 22:50:43 +02:00
|
|
|
GTS_SMTP_FROM='queen.rip.in.piss@terfisland.org' \
|
2023-03-19 13:11:46 +01:00
|
|
|
GTS_SMTP_DISCLOSE_RECIPIENTS=true \
|
2022-06-08 20:28:28 +02:00
|
|
|
GTS_SYSLOG_ENABLED=true \
|
|
|
|
GTS_SYSLOG_PROTOCOL='udp' \
|
|
|
|
GTS_SYSLOG_ADDRESS='127.0.0.1:6969' \
|
2023-05-09 19:19:48 +02:00
|
|
|
GTS_TRACING_ENDPOINT='localhost:4317' \
|
2023-09-07 13:20:37 +02:00
|
|
|
GTS_TRACING_INSECURE_TRANSPORT=true \
|
2022-06-08 20:28:28 +02:00
|
|
|
GTS_ADVANCED_COOKIES_SAMESITE='strict' \
|
2023-08-23 14:32:27 +02:00
|
|
|
GTS_ADVANCED_RATE_LIMIT_EXCEPTIONS="192.0.2.0/24,127.0.0.1/32" \
|
2022-11-06 10:47:48 +01:00
|
|
|
GTS_ADVANCED_RATE_LIMIT_REQUESTS=6969 \
|
2023-05-08 19:03:38 +02:00
|
|
|
GTS_ADVANCED_SENDER_MULTIPLIER=-1 \
|
2023-01-04 11:57:59 +01:00
|
|
|
GTS_ADVANCED_THROTTLING_MULTIPLIER=-1 \
|
2023-02-10 21:16:01 +01:00
|
|
|
GTS_ADVANCED_THROTTLING_RETRY_AFTER='10s' \
|
2023-02-17 12:02:29 +01:00
|
|
|
GTS_REQUEST_ID_HEADER='X-Trace-Id' \
|
2022-11-15 16:53:19 +01:00
|
|
|
go run ./cmd/gotosocial/... --config-path internal/config/testdata/test.yaml debug config)
|
2022-06-08 20:28:28 +02:00
|
|
|
|
2022-09-29 22:50:43 +02:00
|
|
|
OUTPUT_OUT=$(mktemp)
|
|
|
|
echo "$OUTPUT" > "$OUTPUT_OUT"
|
|
|
|
|
|
|
|
EXPECT_OUT=$(mktemp)
|
|
|
|
echo "$EXPECT" > "$EXPECT_OUT"
|
|
|
|
|
2023-02-27 10:23:17 +01:00
|
|
|
DIFFCMD=$(command -v diff 2>&1)
|
|
|
|
if command -v jd >/dev/null 2>&1; then
|
|
|
|
DIFFCMD=$(command -v jd 2>&1)
|
|
|
|
fi
|
|
|
|
|
|
|
|
if ! DIFF=$("$DIFFCMD" "$OUTPUT_OUT" "$EXPECT_OUT"); then
|
2022-06-08 20:28:28 +02:00
|
|
|
echo "OUTPUT not equal EXPECTED"
|
2022-09-29 22:50:43 +02:00
|
|
|
echo "$DIFF"
|
2022-06-08 20:28:28 +02:00
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "OK"
|
2022-09-29 22:50:43 +02:00
|
|
|
exit 0
|
2022-06-08 20:28:28 +02:00
|
|
|
fi
|