diff --git a/.env.example b/.env.example index e9536360..9a486a1f 100644 --- a/.env.example +++ b/.env.example @@ -27,6 +27,14 @@ database.default.username="root" database.default.password="****" database.default.DBPrefix="cp_" +#-------------------------------------------------------------------- +# Email configuration +#-------------------------------------------------------------------- +# email.fromEmail="your_email_address" +# email.SMTPHost="your_smtp_host" +# email.SMTPUser="your_smtp_user" +# email.SMTPPass="your_smtp_password" + #-------------------------------------------------------------------- # Cache configuration (advanced) # @@ -46,3 +54,5 @@ cache.handler="file" # REST API configuration #-------------------------------------------------------------------- # restapi.enabled=true + + diff --git a/app/Config/Email.php b/app/Config/Email.php index 3cf247b5..2f651dca 100644 --- a/app/Config/Email.php +++ b/app/Config/Email.php @@ -8,7 +8,7 @@ use CodeIgniter\Config\BaseConfig; class Email extends BaseConfig { - public string $fromEmail = 'hello@castopod.local'; + public string $fromEmail = ''; public string $fromName = 'Castopod'; @@ -17,12 +17,12 @@ class Email extends BaseConfig /** * The "user agent" */ - public string $userAgent = 'CodeIgniter'; + public string $userAgent = 'Castopod/' . CP_VERSION; /** * The mail sending protocol: mail, sendmail, smtp */ - public string $protocol = 'mail'; + public string $protocol = 'smtp'; /** * The server path to Sendmail. @@ -118,4 +118,11 @@ class Email extends BaseConfig * Enable notify message from server */ public bool $DSN = false; + + public function __construct() + { + parent::__construct(); + + $this->userAgent = 'Castopod/' . CP_VERSION . '; +' . base_url('', 'https'); + } } diff --git a/docs/src/getting-started/docker.md b/docs/src/getting-started/docker.md index 1a057fe4..4d7c3a53 100644 --- a/docs/src/getting-started/docker.md +++ b/docs/src/getting-started/docker.md @@ -117,26 +117,32 @@ can be added as a cache handler. - **castopod/app** - | Variable name | Type (`default`) | - | -------------------------- | ----------------------------------- | - | **`CP_BASEURL`** | string (`undefined`) | - | **`CP_MEDIA_BASEURL`** | ?string (`(empty)`) | - | **`CP_ADMIN_GATEWAY`** | ?string (`"cp-admin"`) | - | **`CP_AUTH_GATEWAY`** | ?string (`"cp-auth"`) | - | **`CP_ANALYTICS_SALT`** | string (`undefined`) | - | **`CP_DATABASE_HOSTNAME`** | ?string (`"mariadb"`) | - | **`CP_DATABASE_NAME`** | string (`MYSQL_DATABASE`) | - | **`CP_DATABASE_USERNAME`** | string (`MYSQL_USER`) | - | **`CP_DATABASE_PASSWORD`** | string (`MYSQL_PASSWORD`) | - | **`CP_DATABASE_PREFIX`** | ?string (`"cp_"`) | - | **`CP_CACHE_HANDLER`** | ?[`"file"` or `"redis"`] (`"file"`) | - | **`CP_REDIS_HOST`** | ?string (`"localhost"`) | - | **`CP_REDIS_PASSWORD`** | ?string (`null`) | - | **`CP_REDIS_PORT`** | ?number (`6379`) | - | **`CP_REDIS_DATABASE`** | ?number (`0`) | + | Variable name | Type (`default`) | Default | + | ---------------------------- | ----------------------- | ---------------- | + | **`CP_BASEURL`** | string | `undefined` | + | **`CP_MEDIA_BASEURL`** | ?string | `CP_BASEURL` | + | **`CP_ADMIN_GATEWAY`** | ?string | `"cp-admin"` | + | **`CP_AUTH_GATEWAY`** | ?string | `"cp-auth"` | + | **`CP_ANALYTICS_SALT`** | string | `undefined` | + | **`CP_DATABASE_HOSTNAME`** | ?string | `"mariadb"` | + | **`CP_DATABASE_NAME`** | ?string | `MYSQL_DATABASE` | + | **`CP_DATABASE_USERNAME`** | ?string | `MYSQL_USER` | + | **`CP_DATABASE_PASSWORD`** | ?string | `MYSQL_PASSWORD` | + | **`CP_DATABASE_PREFIX`** | ?string | `"cp_"` | + | **`CP_CACHE_HANDLER`** | [`"file"` or `"redis"`] | `"file"` | + | **`CP_REDIS_HOST`** | ?string | `"localhost"` | + | **`CP_REDIS_PASSWORD`** | ?string | `null` | + | **`CP_REDIS_PORT`** | ?number | `6379` | + | **`CP_REDIS_DATABASE`** | ?number | `0` | + | **`CP_EMAIL_SMTP_HOST`** | ?string | `undefined` | + | **`CP_EMAIL_FROM`** | ?string | `undefined` | + | **`CP_EMAIL_SMTP_USERNAME`** | ?string | `"localhost"` | + | **`CP_EMAIL_SMTP_PASSWORD`** | ?string | `null` | + | **`CP_EMAIL_SMTP_PORT`** | ?number | `25` | + | **`CP_EMAIL_SMTP_CRYPTO`** | [`"tls"` or `"ssl"`] | `"tls"` | - **castopod/web-server** - | Variable name | Type (`default`) | - | --------------------- | ----------------- | - | **`CP_APP_HOSTNAME`** | ?string (`"app"`) | + | Variable name | Type | Default | + | --------------------- | ------- | ------- | + | **`CP_APP_HOSTNAME`** | ?string | `"app"` | diff --git a/docs/src/getting-started/install.md b/docs/src/getting-started/install.md index 1a366f4e..3d73187d 100644 --- a/docs/src/getting-started/install.md +++ b/docs/src/getting-started/install.md @@ -126,11 +126,40 @@ want to generate Video Clips. The following extensions must be installed: ::: info Note The install script writes a `.env` file in the package root. If you cannot go -through the install wizard, you can -[create and update the `.env` file manually](#alternative-manual-configuration). +through the install wizard, you can create and edit the `.env` file manually +based on the `.env.example` file. ::: +### Email/SMTP setup + +Email configuration is required for some features to work properly (eg. +retrieving your forgotten password, sending instructions to premium subscribers, +…) + +You may add your email configuration in your instance's `.env` like so: + +```ini +# […] + +email.fromEmail="your_email_address" +email.SMTPHost="your_smtp_host" +email.SMTPUser="your_smtp_user" +email.SMTPPass="your_smtp_password" +``` + +#### Email config options + +| Variable name | Type | Default | +| ---------------- | -------------------- | ------------ | +| **`fromEmail`** | string | `undefined` | +| **`fromName`** | string | `"Castopod"` | +| **`SMTPHost`** | string | `undefined` | +| **`SMTPUser`** | string | `undefined` | +| **`SMTPPass`** | string | `undefined` | +| **`SMTPPort`** | number | `25` | +| **`SMTPCrypto`** | [`"tls"` or `"ssl"`] | `"tls"` | + ## Community packages If you don't want to bother with installing Castopod manually, you may use one