Skip to content

Commit

Permalink
move .env to root directory
Browse files Browse the repository at this point in the history
  • Loading branch information
creme332 committed Apr 22, 2024
1 parent 4400a46 commit 5489444
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 28 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ jobs:
BUSINESS_GMAIL=""
BUSINESS_GMAIL_PASSWORD=""
run: |
echo "$ENV" > src/core/.env
cat src/core/.env
echo "$ENV" > .env
cat .env
- name: Validate composer.json and composer.lock
run: composer validate --strict
Expand Down
33 changes: 9 additions & 24 deletions docs/INSTALLATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ Install composer dependencies:
composer update
```

## Environment setup

In the [`src/core/`](../src/core/config.php) folder, create a `.env` file with the following contents:
In the root directory, create a `.env` file with the following contents:

```php
PUBLIC_ROOT="http://localhost/steamy-sips/public"
Expand All @@ -56,28 +54,15 @@ BUSINESS_GMAIL=""
BUSINESS_GMAIL_PASSWORD=""
```

Update the values assigned to `DB_USERNAME` and `DB_PASSWORD` with your MySQL login details.

> [!IMPORTANT]
> If your Apache server is serving from a port other than port 80, include the port number in `PUBLIC_ROOT` (
> e.g., `http://localhost:443/steamy-sips/public`) .
## Mail setup

1. Choose an email address (gmail account) from which you want emails to be sent.
2. Go to https://myaccount.google.com/ and login using your desired email.
3. Search for `2-Step Verification` in the `Security` section and enable it.
4. Search for `App passwords` in the security section and create an app password with a name of your choice.
5. In the `src/core/.env` file created earlier, fill `BUSINESS_GMAIL`
and `BUSINESS_GMAIL_PASSWORD`. `BUSINESS_GMAIL_PASSWORD` should be set to your app password.

> [!IMPORTANT]
> Remove any spaces from your app password when entering it in the `.env` file.
Some important notes:

> [!IMPORTANT]
> Ensure that you have no firewall or antivirus software (e.g. Avast, McAfee) that block emails. If the mailing service
> is not working
> set `$this->mail->SMTPDebug = SMTP::SERVER;` in the `Mailer.php` file and inspect the error.
- Update the values assigned to `DB_USERNAME` and `DB_PASSWORD` with your MySQL login details.
- If your Apache server is serving from a port other than the default one, include the port number to `PUBLIC_ROOT` (
e.g., `http://localhost:443/steamy-sips/public`) .
- `BUSINESS_GMAIL` and `BUSINESS_GMAIL_PASSWORD` are the credentials of the Gmail account from which emails will be sent
whenever a client places an order. It is recommended to use
a [Gmail App password](https://knowledge.workspace.google.com/kb/how-to-create-app-passwords-000009237)
for `BUSINESS_GMAIL_PASSWORD` instead of your actual gmail account password.

## Database setup

Expand Down
2 changes: 1 addition & 1 deletion docs/USAGE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Optionally, you can display a live error log:
sudo tail -f /var/log/apache2/error.log
```

Enter the `PUBLIC_ROOT` value (e.g., http://localhost/steamy-sips/public/) from [`src/core/.env`](../src/core/.env) in
Enter the `PUBLIC_ROOT` value (e.g., http://localhost/steamy-sips/public/) from [`.env`](../.env) in
your browser
to access the client website.

Expand Down
2 changes: 1 addition & 1 deletion src/core/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
declare(strict_types=1);

// load environment variables
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__.'/../..');
$dotenv->load();

// define absolute URL to public folder
Expand Down

0 comments on commit 5489444

Please sign in to comment.