Deployment to various CD/CD environments with alterating default user and password #659
-
| Hello, please suggest me the sensible way to achieve the following: There are 3 environments in Gitlab - DEV, STAGE and PROD. I have a  The obvious way is duplicating  Is there any way to use environment variables in this case? | 
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
| 
 Yes, you can use environment variables in the  Let me know if that works for you. | 
Beta Was this translation helpful? Give feedback.
-
| Thank you very much! You helped me to figure out a solution which I implemented. Here it is. First of all, hash itself is not comfortable to deal with, so I put username and password in plain text to environment variables. 
   "users": [
    {
      "name": "RABBITMQ_USER",
      "password_hash": "RABBITMQ_PASS_HASH",
      "hashing_algorithm": "rabbit_password_hashing_sha256",
      "tags": "administrator",
      "limits": {}
    }
  ],
  "vhosts": [
    {
      "name": "/"
    }
  ],
  "permissions": [
    {
      "user": "RABBITMQ_USER",
      "vhost": "/",
      "configure": ".*",
      "write": ".*",
      "read": ".*"
    }
  ],
  "topic_permissions": [],
  "parameters": [],
  "global_parameters": [],
  "policies": [],
 
  | 
Beta Was this translation helpful? Give feedback.
OK, when you are booting a fresh node, the definitions file import will cause RabbitMQ to ignore the
default_useranddefault_passsettings:https://www.rabbitmq.com/definitions.html#import-on-boot-nuances
This is a good solution. Please see this repository for a full working example:
https://github.com/lukebakken/docker-library_rabbitmq-659
Running this command will start RabbitMQ with the
admin-DEVuser:...while this will create
admin-PROD: