mirror of
				https://github.com/optim-enterprises-bv/Mailu.git
				synced 2025-10-30 17:47:55 +00:00 
			
		
		
		
	Create user for healthcheck
This commit is contained in:
		| @@ -1,10 +1,20 @@ | ||||
| -- name: create_user! | ||||
| -- name: create_mailu_user! | ||||
| -- Create the mailu user if it does not exist. | ||||
| do $$ | ||||
| begin | ||||
|     create user mailu; | ||||
|     exception when others then | ||||
|     raise notice 'not creating mailu user -- it already exists'; | ||||
|     raise notice 'mailu user not created -- already exists'; | ||||
| end | ||||
| $$; | ||||
|  | ||||
| -- name: create_health_user! | ||||
| -- Create the mailu user if it does not exist. | ||||
| do $$ | ||||
| begin | ||||
|     create user health; | ||||
|     exception when others then | ||||
|     raise notice 'health user not created -- already exists'; | ||||
| end | ||||
| $$; | ||||
|  | ||||
|   | ||||
| @@ -9,8 +9,11 @@ import os | ||||
| def setup(): | ||||
|     conn =  psycopg2.connect('user=postgres') | ||||
|     queries = anosql.load_queries('postgres', '/conf/queries.sql') | ||||
|     queries.create_user(conn) | ||||
|     # Mailu user | ||||
|     queries.create_mailu_user(conn) | ||||
|     queries.update_pw(conn, pw=os.environ.get("SECRET_KEY")) | ||||
|     # Healthcheck user | ||||
|     queries.create_health_user(conn) | ||||
|     conn.commit() | ||||
|     # create db cannot be atomic. But this script is the only active connection, this is kinda safe. | ||||
|     if not queries.check_db(conn): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Tim Möhlmann
					Tim Möhlmann