mirror of
https://github.com/bitnami/containers.git
synced 2026-03-02 16:17:31 +08:00
Standardise environment variables
This commit is contained in:
@@ -93,11 +93,11 @@ myapp:
|
||||
|
||||
## Creating the Memcached admin user
|
||||
|
||||
Authentication on the Memcached server is disabled by default. To enable authentication, specify a username and password for the Memcached admin user using the `MEMCACHED_USER` and `MEMCACHED_PASSWORD` environment variables.
|
||||
Authentication on the Memcached server is disabled by default. To enable authentication, specify a username and password for the Memcached admin user using the `MEMCACHED_USERNAME` and `MEMCACHED_PASSWORD` environment variables.
|
||||
|
||||
```bash
|
||||
docker run --name memcached \
|
||||
-e MEMCACHED_USER=my_user \
|
||||
-e MEMCACHED_USERNAME=my_user \
|
||||
-e MEMCACHED_PASSWORD=my_password \
|
||||
bitnami/memcached:latest
|
||||
```
|
||||
@@ -108,11 +108,11 @@ or using Docker Compose:
|
||||
memcached:
|
||||
image: bitnami/memcached:latest
|
||||
environment:
|
||||
- MEMCACHED_USER=my_user
|
||||
- MEMCACHED_USERNAME=my_user
|
||||
- MEMCACHED_PASSWORD=my_password
|
||||
```
|
||||
|
||||
> The default value of the `MEMCACHED_USER` is `root`.
|
||||
> The default value of the `MEMCACHED_USERNAME` is `root`.
|
||||
|
||||
# Logging
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ function initialize {
|
||||
}
|
||||
|
||||
# Set default values
|
||||
export MEMCACHED_USER=${MEMCACHED_USER:-root}
|
||||
export MEMCACHED_USERNAME=${MEMCACHED_USERNAME:-root}
|
||||
export MEMCACHED_PASSWORD=${MEMCACHED_PASSWORD:-}
|
||||
|
||||
if [[ "$1" == "nami" && "$2" == "start" ]] || [[ "$1" == "/init.sh" ]]; then
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"username": "{{$global.env.MEMCACHED_USER}}",
|
||||
"username": "{{$global.env.MEMCACHED_USERNAME}}",
|
||||
"password": "{{$global.env.MEMCACHED_PASSWORD}}"
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env bats
|
||||
|
||||
MEMCACHED_USER=test_user
|
||||
MEMCACHED_USERNAME=test_user
|
||||
MEMCACHED_PASSWORD=test_password123
|
||||
|
||||
RUBY_CONTAINER_NAME=bitnami-ruby-test
|
||||
@@ -60,12 +60,12 @@ create_ruby_container() {
|
||||
|
||||
@test "Can create custom user with password" {
|
||||
container_create default -d \
|
||||
-e MEMCACHED_USER=$MEMCACHED_USER \
|
||||
-e MEMCACHED_USERNAME=$MEMCACHED_USERNAME \
|
||||
-e MEMCACHED_PASSWORD=$MEMCACHED_PASSWORD
|
||||
|
||||
create_ruby_container
|
||||
|
||||
run docker exec $RUBY_CONTAINER_NAME \
|
||||
ruby -e "require 'dalli'; Dalli::Client.new('$APP_NAME:11211', {username: '$MEMCACHED_USER', password: '$MEMCACHED_PASSWORD'}).set('test', 'bitnami')"
|
||||
ruby -e "require 'dalli'; Dalli::Client.new('$APP_NAME:11211', {username: '$MEMCACHED_USERNAME', password: '$MEMCACHED_PASSWORD'}).set('test', 'bitnami')"
|
||||
[[ "$output" =~ "Authenticated" ]]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user