-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: env directory path #9631
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
Open
totoprayogo1916
wants to merge
5
commits into
codeigniter4:4.7
Choose a base branch
from
totoprayogo1916:feat/env-dir
base: 4.7
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+41
−5
Open
feat: env directory path #9631
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
23c6881
feat: add environment directory to load .env file
totoprayogo1916 fb4e411
fix: rename environment directory variable from environmentDirectory …
totoprayogo1916 7d66f4b
docs: add information about changing .env file location
totoprayogo1916 92bfc1e
fix: improve environment variable loading with fallback to ROOTPATH
totoprayogo1916 2592dbb
fix: dynamic path for .env file
totoprayogo1916 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -97,3 +97,26 @@ of those: | |||||||
.. literalinclude:: managing_apps/004.php | ||||||||
|
||||||||
Only when you change the Application Directory, see :ref:`renaming-app-directory` and modify the paths in the **index.php** and **spark**. | ||||||||
|
||||||||
Changing the Location of the .env File | ||||||||
====================================== | ||||||||
|
||||||||
If necessary, you can change the location of the ``.env`` file by adjusting the ``$envDirectory`` | ||||||||
property in ``app/Config/Paths.php``. | ||||||||
|
||||||||
By default, the framework loads environment settings from a ``.env`` file located one level above | ||||||||
the ``app/`` directory (in the ``ROOTPATH``). This is a safe location when your domain is correctly | ||||||||
pointed to the ``public/`` directory, as recommended. | ||||||||
|
||||||||
In practice, however, some applications are served from a subdirectory (e.g., ``http://example.com/myapp``) | ||||||||
rather than from the main domain. In such cases, placing the ``.env`` file within the ``ROOTPATH`` may expose | ||||||||
sensitive configuration if ``.htaccess`` or other protections are misconfigured. | ||||||||
|
||||||||
To avoid this risk in such setups, it is recommended to ensure the ``.env`` file is located outside any | ||||||||
web-accessible directories. | ||||||||
Comment on lines
+115
to
+116
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
|
||||||||
.. warning:: | ||||||||
|
||||||||
If you change the location of the ``.env`` file, make absolutely sure it is not publicly accessible. | ||||||||
Exposure of this file could lead to compromised credentials and access to critical services, such as your | ||||||||
database, mail server, or third-party APIs. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.