Skip to content

Use Environment Variables for Fake User and Password in Management Command #63

@PublisherName

Description

@PublisherName

Description

The current implementation of the management command hardcodes the fake user credentials (fakeuser and fakepassword). To improve security and flexibility, these values should be sourced from environment variables.

def handle(self, *args, **kwargs):
user, _ = User.objects.get_or_create(
username="fakeuser", defaults={"password": "fakepassword"}
)

Proposed Solution

  1. Replace the hardcoded username and password with values retrieved from environment variables.
  2. Use fallback defaults in case the environment variables are not defined, ensuring backward compatibility.

Metadata

Metadata

Assignees

Labels

Projects

Status

Completed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions