Skip to content

Commit

Permalink
sync
Browse files Browse the repository at this point in the history
  • Loading branch information
jippi committed Feb 10, 2024
1 parent be81b95 commit fe4f8f8
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 44 deletions.
76 changes: 38 additions & 38 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ APP_NAME="Pixelfed Prod"
#
# @see https://docs.pixelfed.org/technical-documentation/config/#app_domain
# @dottie/validate required
APP_DOMAIN=""
APP_DOMAIN=

# This URL is used by the console to properly generate URLs when using the Artisan command line tool.
# You should set this to the root of your application so that it is used when running Artisan tasks.
#
# @see https://docs.pixelfed.org/technical-documentation/config/#app_url
# @dottie/validate required
APP_URL="https://${APP_DOMAIN}"
APP_URL="https://${APP_DOMAIN:?error}"

# Application domains used for routing.
#
# @see https://docs.pixelfed.org/technical-documentation/config/#admin_domain
# @dottie/validate required
ADMIN_DOMAIN="${APP_DOMAIN}"
ADMIN_DOMAIN="${APP_DOMAIN:?error}"

# This value determines the “environment” your application is currently running in.
# This may determine how you prefer to configure various services your application utilizes.
Expand Down Expand Up @@ -221,7 +221,7 @@ APP_TIMEZONE="UTC"
# @default ""
# @see https://docs.pixelfed.org/technical-documentation/config/#instance_contact_email
# @dottie/validate required
INSTANCE_CONTACT_EMAIL="admin@${APP_DOMAIN}"
INSTANCE_CONTACT_EMAIL="admin@${APP_DOMAIN:?error}"

# @default "false"
# @see https://docs.pixelfed.org/technical-documentation/config/#instance_public_local_timeline
Expand Down Expand Up @@ -250,7 +250,7 @@ INSTANCE_CONTACT_EMAIL="admin@${APP_DOMAIN}"

# The host to request LetsEncrypt certificate for
# @dottie/validate required
LETSENCRYPT_HOST="${APP_DOMAIN}"
LETSENCRYPT_HOST="${APP_DOMAIN:?error}"

# The e-mail to use for Lets Encrypt certificate requests.
# @dottie/validate required,email
Expand Down Expand Up @@ -361,12 +361,12 @@ DB_APPLY_NEW_MIGRATIONS_AUTOMATICALLY="false"
# @default "hello@example.com"
# @see https://docs.pixelfed.org/technical-documentation/config/#mail_from_address
# @dottie/validate required_with=MAIL_DRIVER
MAIL_FROM_ADDRESS="hello@${APP_DOMAIN}"
MAIL_FROM_ADDRESS="hello@${APP_DOMAIN:?error}"

# @default "Example"
# @see https://docs.pixelfed.org/technical-documentation/config/#mail_from_name
# @dottie/validate required_with=MAIL_DRIVER
MAIL_FROM_NAME="Pixelfed @ ${APP_DOMAIN}"
MAIL_FROM_NAME="Pixelfed @ ${APP_DOMAIN:?error}"

# If your SMTP server requires a username for authentication, you should set it here.
#
Expand Down Expand Up @@ -547,7 +547,7 @@ CACHE_DRIVER="redis"
# @default "false"
# @see https://docs.pixelfed.org/technical-documentation/config/#activity_pub
# @dottie/validate required,boolean
ACTIVITY_PUB="true"
#ACTIVITY_PUB="true"

# @default "true"
# @see https://docs.pixelfed.org/technical-documentation/config/#ap_remote_follow
Expand Down Expand Up @@ -949,15 +949,15 @@ TRUST_PROXIES="*"
#
# @see https://www.php.net/manual/en/timezones.php
# @dottie/validate required,timezone
TZ="${APP_TIMEZONE}"
TZ="${APP_TIMEZONE:?error}"

################################################################################
# Docker configuraton for *all* services
################################################################################

# Prefix for container names (without any dash at the end)
# @dottie/validate required
DOCKER_ALL_CONTAINER_NAME_PREFIX="${APP_DOMAIN}"
DOCKER_ALL_CONTAINER_NAME_PREFIX="${APP_DOMAIN:?error}"

# How often Docker health check should run for all services
#
Expand All @@ -978,19 +978,19 @@ DOCKER_ALL_HOST_ROOT_PATH="./docker-compose-state"
#
# @default "${DOCKER_ALL_HOST_ROOT_PATH}/data"
# @dottie/validate required,dir
DOCKER_ALL_HOST_DATA_ROOT_PATH="${DOCKER_ALL_HOST_ROOT_PATH}/data"
DOCKER_ALL_HOST_DATA_ROOT_PATH="${DOCKER_ALL_HOST_ROOT_PATH:?error}/data"

# Path (relative to the docker-compose.yml) or absolute (/some/other/path) where containers will store their confguration
#
# @default "${DOCKER_ALL_HOST_ROOT_PATH}/config"
# @dottie/validate required,dir
DOCKER_ALL_HOST_CONFIG_ROOT_PATH="${DOCKER_ALL_HOST_ROOT_PATH}/config"
DOCKER_ALL_HOST_CONFIG_ROOT_PATH="${DOCKER_ALL_HOST_ROOT_PATH:?error}/config"

# Path (relative to the docker-compose.yml) or absolute (/some/other/path) where containers will store overrides
#
# @default "${DOCKER_ALL_HOST_ROOT_PATH}/overrides"
# @dottie/validate required,dir
DOCKER_APP_HOST_OVERRIDES_PATH="${DOCKER_ALL_HOST_ROOT_PATH}/overrides"
DOCKER_APP_HOST_OVERRIDES_PATH="${DOCKER_ALL_HOST_ROOT_PATH:?error}/overrides"

################################################################################
# Docker [web] + [worker] (also know as "app") shared service configuration
Expand Down Expand Up @@ -1060,21 +1060,21 @@ DOCKER_APP_IMAGE="ghcr.io/jippi/pixelfed"
#
# @see https://github.com/pixelfed/pixelfed/pkgs/container/pixelfed
# @dottie/validate required
DOCKER_APP_TAG="${DOCKER_APP_RELEASE}-${DOCKER_APP_RUNTIME}-${DOCKER_APP_PHP_VERSION}"
DOCKER_APP_TAG="${DOCKER_APP_RELEASE:?error}-${DOCKER_APP_RUNTIME:?error}-${DOCKER_APP_PHP_VERSION:?error}"

# Path (on host system) where the [app] + [worker] container will write
# its [storage] data (e.g uploads/images/profile pictures etc.).
#
# Path is relative (./some/other/path) to the docker-compose.yml or absolute (/some/other/path)
# @dottie/validate required,dir
DOCKER_APP_HOST_STORAGE_PATH="${DOCKER_ALL_HOST_DATA_ROOT_PATH}/pixelfed/storage"
DOCKER_APP_HOST_STORAGE_PATH="${DOCKER_ALL_HOST_DATA_ROOT_PATH:?error}/pixelfed/storage"

# Path (on host system) where the [app] + [worker] container will write
# its [cache] data.
#
# Path is relative (./some/other/path) to the docker-compose.yml or absolute (/some/other/path)
# @dottie/validate required,dir
DOCKER_APP_HOST_CACHE_PATH="${DOCKER_ALL_HOST_DATA_ROOT_PATH}/pixelfed/cache"
DOCKER_APP_HOST_CACHE_PATH="${DOCKER_ALL_HOST_DATA_ROOT_PATH:?error}/pixelfed/cache"

# Automatically run "One-time setup tasks" commands.
#
Expand Down Expand Up @@ -1137,11 +1137,11 @@ DOCKER_REDIS_VERSION="7.2"
#
# Path is relative (./some/other/path) to the docker-compose.yml or absolute (/some/other/path)
# @dottie/validate required,dir
DOCKER_REDIS_HOST_DATA_PATH="${DOCKER_ALL_HOST_DATA_ROOT_PATH}/redis"
DOCKER_REDIS_HOST_DATA_PATH="${DOCKER_ALL_HOST_DATA_ROOT_PATH:?error}/redis"

# Port that Redis will listen on *outside* the container (e.g. the host machine)
# @dottie/validate required,number
DOCKER_REDIS_HOST_PORT="${REDIS_PORT}"
DOCKER_REDIS_HOST_PORT="${REDIS_PORT:?error}"

# The filename that Redis should store its config file within
#
Expand All @@ -1157,7 +1157,7 @@ DOCKER_REDIS_HOST_PORT="${REDIS_PORT}"
#
# @default "10s"
# @dottie/validate required
DOCKER_REDIS_HEALTHCHECK_INTERVAL="${DOCKER_ALL_DEFAULT_HEALTHCHECK_INTERVAL}"
DOCKER_REDIS_HEALTHCHECK_INTERVAL="${DOCKER_ALL_DEFAULT_HEALTHCHECK_INTERVAL:?error}"

################################################################################
# Docker [db] service configuration
Expand All @@ -1170,17 +1170,17 @@ DOCKER_REDIS_HEALTHCHECK_INTERVAL="${DOCKER_ALL_DEFAULT_HEALTHCHECK_INTERVAL}"
#
# Path is relative (./some/other/path) to the docker-compose.yml or absolute (/some/other/path)
# @dottie/validate required,dir
DOCKER_DB_HOST_DATA_PATH="${DOCKER_ALL_HOST_DATA_ROOT_PATH}/db"
DOCKER_DB_HOST_DATA_PATH="${DOCKER_ALL_HOST_DATA_ROOT_PATH:?error}/db"

# Port that the database will listen on *outside* the container (e.g. the host machine)
#
# Use "3306" for MySQL/MariaDB and "5432" for PostgreeSQL
# @dottie/validate required,number
DOCKER_DB_HOST_PORT="${DB_PORT}"
DOCKER_DB_HOST_PORT="${DB_PORT:?error}"

# How often Docker health check should run for [db] service
# @dottie/validate required
DOCKER_DB_HEALTHCHECK_INTERVAL="${DOCKER_ALL_DEFAULT_HEALTHCHECK_INTERVAL}"
DOCKER_DB_HEALTHCHECK_INTERVAL="${DOCKER_ALL_DEFAULT_HEALTHCHECK_INTERVAL:?error}"

################################################################################
# Docker [web] service configuration
Expand All @@ -1196,7 +1196,7 @@ DOCKER_WEB_PORT_EXTERNAL_HTTP="8080"

# How often Docker health check should run for [web] service
# @dottie/validate required
DOCKER_WEB_HEALTHCHECK_INTERVAL="${DOCKER_ALL_DEFAULT_HEALTHCHECK_INTERVAL}"
DOCKER_WEB_HEALTHCHECK_INTERVAL="${DOCKER_ALL_DEFAULT_HEALTHCHECK_INTERVAL:?error}"

################################################################################
# Docker [worker] service configuration
Expand All @@ -1208,23 +1208,23 @@ DOCKER_WEB_HEALTHCHECK_INTERVAL="${DOCKER_ALL_DEFAULT_HEALTHCHECK_INTERVAL}"

# How often Docker health check should run for [worker] service
# @dottie/validate required
DOCKER_WORKER_HEALTHCHECK_INTERVAL="${DOCKER_ALL_DEFAULT_HEALTHCHECK_INTERVAL}"
DOCKER_WORKER_HEALTHCHECK_INTERVAL="${DOCKER_ALL_DEFAULT_HEALTHCHECK_INTERVAL:?error}"

################################################################################
# Docker [proxy] + [proxy-acme] service configuration
################################################################################

# Set this to a non-empty value (e.g. "disabled") to disable the [proxy] and [proxy-acme] service
# @dottie/validate required
DOCKER_PROXY_PROFILE=""
DOCKER_PROXY_PROFILE=

# Set this to a non-empty value (e.g. "disabled") to disable the [proxy-acme] service
# @dottie/validate required
DOCKER_PROXY_ACME_PROFILE="${DOCKER_PROXY_PROFILE}"
DOCKER_PROXY_ACME_PROFILE="${DOCKER_PROXY_PROFILE?error}"

# How often Docker health check should run for [proxy] service
# @dottie/validate required
DOCKER_PROXY_HEALTHCHECK_INTERVAL="${DOCKER_ALL_DEFAULT_HEALTHCHECK_INTERVAL}"
DOCKER_PROXY_HEALTHCHECK_INTERVAL="${DOCKER_ALL_DEFAULT_HEALTHCHECK_INTERVAL:?error}"

# Port that the [proxy] will listen on *outside* the container (e.g. the host machine) for HTTP traffic
# @dottie/validate required,number
Expand Down Expand Up @@ -1257,10 +1257,10 @@ DOCKER_PROXY_HOST_DOCKER_SOCKET_PATH="/var/run/docker.sock"
#
# ! DO NOT CHANGE unless you know what you are doing

MYSQL_ROOT_PASSWORD="${DB_PASSWORD}"
MYSQL_USER="${DB_USERNAME}"
MYSQL_PASSWORD="${DB_PASSWORD}"
MYSQL_DATABASE="${DB_DATABASE}"
MYSQL_ROOT_PASSWORD="${DB_PASSWORD:?error}"
MYSQL_USER="${DB_USERNAME:?error}"
MYSQL_PASSWORD="${DB_PASSWORD:?error}"
MYSQL_DATABASE="${DB_DATABASE:?error}"

################################################################################
# Docker [db] service environment variables for MySQL (MariaDB)
Expand All @@ -1271,10 +1271,10 @@ MYSQL_DATABASE="${DB_DATABASE}"
#
# ! DO NOT CHANGE unless you know what you are doing

MARIADB_ROOT_PASSWORD="${DB_PASSWORD}"
MARIADB_USER="${DB_USERNAME}"
MARIADB_PASSWORD="${DB_PASSWORD}"
MARIADB_DATABASE="${DB_DATABASE}"
MARIADB_ROOT_PASSWORD="${DB_PASSWORD:?error}"
MARIADB_USER="${DB_USERNAME:?error}"
MARIADB_PASSWORD="${DB_PASSWORD:?error}"
MARIADB_DATABASE="${DB_DATABASE:?error}"

################################################################################
# Docker [db] service environment variables for PostgreSQL
Expand All @@ -1284,6 +1284,6 @@ MARIADB_DATABASE="${DB_DATABASE}"
#
# ! DO NOT CHANGE unless you know what you are doing

POSTGRES_USER="${DB_USERNAME}"
POSTGRES_PASSWORD="${DB_PASSWORD}"
POSTGRES_DB="${DB_DATABASE}"
POSTGRES_USER="${DB_USERNAME:?error}"
POSTGRES_PASSWORD="${DB_PASSWORD:?error}"
POSTGRES_DB="${DB_DATABASE:?error}"
25 changes: 19 additions & 6 deletions pkg/cli/shared/complete.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package shared

import (
"github.com/davecgh/go-spew/spew"
"github.com/jippi/dottie/pkg/render"
"github.com/spf13/cobra"
)
Expand Down Expand Up @@ -36,13 +37,25 @@ func (c *Completer) Get() CobraCompleter {
return nil, cobra.ShellCompDirectiveError
}

settings.Apply(render.WithFilterKeyPrefix(toComplete))
spew.Dump(toComplete)

settings.Apply(c.options...)
settings.Apply(render.WithFilterKeyPrefix(toComplete))

lines := render.
NewUnfilteredRenderer(*settings, c.handlers...).
Statement(env).
Lines()

return render.
NewUnfilteredRenderer(*settings, c.handlers...).
Statement(env).
Lines(),
cobra.ShellCompDirectiveDefault
switch len(lines) {
case 0:
return lines, cobra.ShellCompDirectiveNoSpace

case 1:
return []string{lines[0] + "="}, cobra.ShellCompDirectiveNoSpace

default:
return lines, cobra.ShellCompDirectiveNoSpace
}
}
}

0 comments on commit fe4f8f8

Please sign in to comment.