Skip to content

Conversation

@dyanakiev
Copy link
Member

Add Site ENV Read API Endpoint

Description

Adds a new API endpoint that allows reading a site's .env file content through the API. This enables programmatic access to environment configurations and complements the existing env update endpoint.

API Details

New Endpoint

GET /api/projects/{project}/servers/{server}/sites/{site}/env

Authentication

  • Requires authentication token
  • Requires 'read' ability

Example Response

{
    "data": {
        "env": "APP_NAME=Laravel\nAPP_ENV=production\nDB_HOST=localhost"
    }
}

- Add GET /api/projects/{project}/servers/{server}/sites/{site}/env endpoint
- Add feature tests with SSH mocking
@dyanakiev dyanakiev changed the title feat(api): Add endpoint for reading site .env file feat(api): Add endpoint for reading and updating site .env file Mar 24, 2025
@dyanakiev
Copy link
Member Author

Update PR: Added ENV Update Endpoint

In addition to the previous changes, this PR now includes:

New API Endpoint

Added ability to update env content via API:
PUT /api/projects/{project}/servers/{server}/sites/{site}/env

Example Requst Body

{
    "env": "APP_NAME=MyApp\nAPP_ENV=production"
}

# Conflicts:
#	app/Http/Controllers/API/SiteController.php
#	tests/Feature/API/SitesTest.php
@saeedvaziry saeedvaziry merged commit e98e974 into vitodeploy:2.x Apr 5, 2025
3 checks passed
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.

2 participants