Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add function to write header block to .env file #559

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 5 commits into
base: main
Choose a base branch
Loading
from

Conversation

ankona
Copy link

@ankona ankona commented May 6, 2025

Feature request

Sometimes a user may wish to include a header block in the .env file that is produced. For example, to indicate that the file is automatically generated and updates will not persist:

Sample .env containing header

# This file is automatically generated. Any
# manual changes may be overwritten at any
# time by system XYZ.
a=b
c=d

Proposed Addition

Create a set_header method to write a header block out to the target .env file

Usage

import textwrap
from dotenv import set_header

header = textwrap.dedent(
    """
    # This file is automatically generated. Any
    # manual changes may be overwritten at any
    # time by system XYZ.
    """
)
set_header("~/.env", header)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
Morty Proxy This is a proxified and sanitized view of the page, visit original site.