mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	Extend docs with superuser
This commit is contained in:
		@@ -177,6 +177,30 @@ PAPERLESS_AUTO_LOGIN_USERNAME=<username>
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    Defaults to none, which disables this feature.
 | 
					    Defaults to none, which disables this feature.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PAPERLESS_ADMIN_USER=<username>
 | 
				
			||||||
 | 
					    If this environment variable is specified, Paperless automatically creates 
 | 
				
			||||||
 | 
					    a superuser with the provided username at start. This is useful in cases 
 | 
				
			||||||
 | 
					    where you can not run the `create-superuser` command seperately, such as Kubernetes 
 | 
				
			||||||
 | 
					    or AWS ECS.
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    Requires `PAPERLESS_ADMIN_PASSWORD` to be set.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    .. note::
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        This will not change an existing [super]user's password, nor will
 | 
				
			||||||
 | 
					        it recreate a user that already exists. You can leave this throughout
 | 
				
			||||||
 | 
					        the lifecycle of the containers.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PAPERLESS_ADMIN_MAIL=<email>
 | 
				
			||||||
 | 
					    (Optional) Specify superuser email address. Only used when 
 | 
				
			||||||
 | 
					    `PAPERLESS_ADMIN_USER` is set.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Defaults to ``root@localhost``.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PAPERLESS_ADMIN_PASSWORD=<password>
 | 
				
			||||||
 | 
					    Only used when `PAPERLESS_ADMIN_USER` is set.
 | 
				
			||||||
 | 
					    This will be the password of the automatically created superuser.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
PAPERLESS_COOKIE_PREFIX=<str>
 | 
					PAPERLESS_COOKIE_PREFIX=<str>
 | 
				
			||||||
    Specify a prefix that is added to the cookies used by paperless to identify
 | 
					    Specify a prefix that is added to the cookies used by paperless to identify
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,5 +26,8 @@ class Command(BaseCommand):
 | 
				
			|||||||
                    # Create superuser based on env variables
 | 
					                    # Create superuser based on env variables
 | 
				
			||||||
                    User.objects.create_superuser(PAPERLESS_ADMIN_USER, PAPERLESS_ADMIN_MAIL, PAPERLESS_ADMIN_PASSWORD)
 | 
					                    User.objects.create_superuser(PAPERLESS_ADMIN_USER, PAPERLESS_ADMIN_MAIL, PAPERLESS_ADMIN_PASSWORD)
 | 
				
			||||||
                    self.stdout.write(f'Created superuser "{PAPERLESS_ADMIN_USER}" with provided password.')
 | 
					                    self.stdout.write(f'Created superuser "{PAPERLESS_ADMIN_USER}" with provided password.')
 | 
				
			||||||
 | 
					                else:
 | 
				
			||||||
 | 
					                    self.stdout.write(f'Did not create superuser "{PAPERLESS_ADMIN_USER}".')
 | 
				
			||||||
 | 
					                    self.stdout.write('Make sure you specified "PAPERLESS_ADMIN_PASSWORD" in your "docker-compose.env" file.')
 | 
				
			||||||
            except Exception as error:
 | 
					            except Exception as error:
 | 
				
			||||||
                self.stdout.write(f'Exception occured while managing superuser: {error}')
 | 
					                self.stdout.write(f'Exception occured while creating superuser: {error}')
 | 
				
			||||||
		Reference in New Issue
	
	Block a user