Skip to content

Commit

Permalink
Merge pull request #57 from silinternational/release/1.11.0
Browse files Browse the repository at this point in the history
Release 1.11.0 - AppConfig
  • Loading branch information
briskt authored Apr 8, 2024
2 parents 4040e90 + d527cf5 commit 675694a
Show file tree
Hide file tree
Showing 11 changed files with 821 additions and 727 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ vars.DOCKER_ORG }}/email-service
images: ${{ vars.DOCKER_ORG }}/${{ github.event.repository.name }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ COPY dockerbuild/vhost.conf /etc/apache2/sites-enabled/
# ErrorLog inside a VirtualHost block is ineffective for unknown reasons
RUN sed -i -E 's@ErrorLog .*@ErrorLog /proc/self/fd/2@i' /etc/apache2/apache2.conf

ADD https://github.com/silinternational/config-shim/releases/latest/download/config-shim.gz config-shim.gz
RUN gzip -d config-shim.gz && chmod 755 config-shim && mv config-shim /usr/local/bin

EXPOSE 80

CMD ["/data/run.sh"]
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@ Simple service to queue and send emails
2. `make`
3. Upon successful initialization, the API will be available locally at `http://localhost:8080/email`

## Configuration
By default, configuration is read from environment variables. These are documented
in the `local.env.dist` file. Optionally, you can define configuration in AWS AppConfig.
To do this, set the following environment variables to point to the configuration in
AWS:

* `AWS_REGION` - the AWS region in use
* `APP_ID` - the application ID or name
* `CONFIG_ID` - the configuration profile ID or name
* `ENV_ID` - the environment ID or name

In addition, the AWS API requires authentication. It is best to use an access role
such as an [ECS Task Role](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-iam-roles.html).
If that is not an option, you can specify an access token using the `AWS_ACCESS_KEY_ID` and
`AWS_SECRET_ACCESS_KEY` variables.

The content of the configuration profile takes the form of a typical .env file, using
`#` for comments and `=` for variable assignment. Any variables read from AppConfig
will overwrite variables set in the execution environment.

## API
See [api.raml](api.raml) for API docs.

Expand Down
3 changes: 2 additions & 1 deletion application/common/config/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
$mysqlDatabase = Env::requireEnv('MYSQL_DATABASE');
$mysqlUser = Env::requireEnv('MYSQL_USER');
$mysqlPassword = Env::requireEnv('MYSQL_PASSWORD');
$notificationEmail = Env::requireEnv('NOTIFICATION_EMAIL');
$notificationEmail = Env::get('NOTIFICATION_EMAIL');

$emailQueueBatchSize = Env::get('EMAIL_QUEUE_BATCH_SIZE', 10);
$mailerUseFiles = Env::get('MAILER_USEFILES', false);
Expand Down Expand Up @@ -71,6 +71,7 @@
'exportInterval' => 1,
],
[
'enabled' => !empty($notificationEmail),
'class' => EmailTarget::class,
'except' => [
'yii\web\HttpException:400',
Expand Down
2 changes: 1 addition & 1 deletion application/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}
],
"require": {
"php": ">=7.0",
"php": ">=8.1",
"ext-json":"*",
"aws/aws-sdk-php": "^3.136",
"fillup/fake-bower-assets": "2.0.9",
Expand Down
Loading

0 comments on commit 675694a

Please sign in to comment.