metacpan / metacpan-docker

DEVELOPMENT Docker configs for MetaCPAN
Artistic License 2.0
26 stars 23 forks source link

Set MOJO_MODE for Docker Environment #96

Closed bodo-hugo-barwich closed 1 year ago

bodo-hugo-barwich commented 1 year ago

This development will revert changes in the CircleCI Automated Test Environment and add MOJO_MODE environment variables to the Docker environment in which the tests are run and which define actually the local development environment.

The Service api will be marked with MOJO_MODE set to "development". And the Service api_test will be marked with MOJO_MODE set to "testing"

bodo-hugo-barwich commented 1 year ago

This is an important setting to clearly identify different environments and thereby protect different operations to only be available in clearly marked development and testing environments as required at: Fix a Corrupted ElasticSearch Index

bodo-hugo-barwich commented 1 year ago

The CircleCI Automated Tests show that for the api_test service the localapi_test.env file is loaded which sets MOJO_MODE to "testing". This allows operations which are otherwise blocked like the --delete --all operation which clears all ElasticSearch indices. CircleCI Automated Tests

Use of uninitialized value $ENV{"PLACK_ENV"} in concatenation (.) or string at t/lib/MetaCPAN/TestServer.pm line 377.
test_delete_fails - PLACK_ENV: ''
test_delete_fails - MOJO_MODE: 'testing'
2022/12/30 18:29:41 E mapping: Operation not permitted!
[2022/12/30 18:29:41] [catalyst] [ERROR] Operation not permitted!
2022/12/30 18:29:41 F mapping: Operation not permitted in environment: production
[2022/12/30 18:29:41] [catalyst] [FATAL] Operation not permitted in environment: production