Add endpoint for reading and updating site .env file (#564)

* feat(api): Add endpoint for reading site .env file

- Add GET /api/projects/{project}/servers/{server}/sites/{site}/env endpoint
- Add feature tests with SSH mocking

* added updating env

* fix coding style

* generate docs

---------

Co-authored-by: Saeed Vaziry <mr.saeedvaziry@gmail.com>
This commit is contained in:
Dimitar Yanakiev
2025-04-05 20:59:57 +03:00
committed by GitHub
parent 2a670146d8
commit e98e974e20
31 changed files with 2404 additions and 1395 deletions

View File

@ -39,7 +39,7 @@ endpoints:
responses:
-
status: 200
content: '{"data":[{"id":null,"project_id":null,"user_id":null,"provider_id":null,"name":"Marcelino Rodriguez","ssh_user":"vito","ip":"128.182.22.13","local_ip":"19.119.134.124","port":22,"os":"ubuntu_22","type":"regular","type_data":null,"provider":"custom","provider_data":null,"public_key":"test","status":"ready","auto_update":null,"available_updates":0,"security_updates":null,"progress":100,"progress_step":null,"updates":null,"last_update_check":null,"created_at":null,"updated_at":null},{"id":null,"project_id":null,"user_id":null,"provider_id":null,"name":"Everardo Conn","ssh_user":"vito","ip":"62.215.59.124","local_ip":"32.153.141.12","port":22,"os":"ubuntu_22","type":"regular","type_data":null,"provider":"custom","provider_data":null,"public_key":"test","status":"ready","auto_update":null,"available_updates":0,"security_updates":null,"progress":100,"progress_step":null,"updates":null,"last_update_check":null,"created_at":null,"updated_at":null}],"links":{"first":"\/?page=1","last":"\/?page=1","prev":null,"next":null},"meta":{"current_page":1,"from":1,"last_page":1,"links":[{"url":null,"label":"&laquo; Previous","active":false},{"url":"\/?page=1","label":"1","active":true},{"url":null,"label":"Next &raquo;","active":false}],"path":"\/","per_page":25,"to":2,"total":2}}'
content: '{"data":[{"id":null,"project_id":null,"user_id":null,"provider_id":null,"name":"Miss Bonita Vandervort IV","ssh_user":"vito","ip":"120.222.195.212","local_ip":"138.119.37.248","port":22,"os":"ubuntu_22","type":"regular","type_data":null,"provider":"custom","provider_data":null,"public_key":"test","status":"ready","auto_update":null,"available_updates":0,"security_updates":null,"progress":100,"progress_step":null,"updates":null,"last_update_check":null,"created_at":null,"updated_at":null},{"id":null,"project_id":null,"user_id":null,"provider_id":null,"name":"Dr. Shanie Batz IV","ssh_user":"vito","ip":"241.88.138.163","local_ip":"138.226.232.93","port":22,"os":"ubuntu_22","type":"regular","type_data":null,"provider":"custom","provider_data":null,"public_key":"test","status":"ready","auto_update":null,"available_updates":0,"security_updates":null,"progress":100,"progress_step":null,"updates":null,"last_update_check":null,"created_at":null,"updated_at":null}],"links":{"first":"\/?page=1","last":"\/?page=1","prev":null,"next":null},"meta":{"current_page":1,"from":1,"last_page":1,"links":[{"url":null,"label":"&laquo; Previous","active":false},{"url":"\/?page=1","label":"1","active":true},{"url":null,"label":"Next &raquo;","active":false}],"path":"\/","per_page":25,"to":2,"total":2}}'
headers: []
description: ''
custom: []
@ -47,7 +47,7 @@ endpoints:
auth:
- headers
- Authorization
- 'Bearer 8V6gP6cZk143he5EadfbDva'
- 'Bearer Pg1Vk6cvadD8eb3ZhaEf564'
controller: null
method: null
route: null
@ -89,7 +89,7 @@ endpoints:
name: provider
description: 'The server provider type'
required: true
example: ut
example: fugiat
type: string
enumValues: []
exampleWasSpecified: false
@ -99,7 +99,7 @@ endpoints:
name: server_provider
description: 'If the provider is not custom, the ID of the server provider profile'
required: true
example: hetzner
example: digitalocean
type: string
enumValues:
- custom
@ -114,7 +114,7 @@ endpoints:
name: region
description: 'Provider region if the provider is not custom'
required: true
example: consectetur
example: itaque
type: string
enumValues: []
exampleWasSpecified: false
@ -134,7 +134,7 @@ endpoints:
name: ip
description: 'SSH IP address if the provider is custom'
required: true
example: quisquam
example: ut
type: string
enumValues: []
exampleWasSpecified: false
@ -144,7 +144,7 @@ endpoints:
name: port
description: 'SSH Port if the provider is custom'
required: true
example: sapiente
example: reiciendis
type: string
enumValues: []
exampleWasSpecified: false
@ -154,7 +154,7 @@ endpoints:
name: name
description: 'The name of the server.'
required: true
example: itaque
example: et
type: string
enumValues: []
exampleWasSpecified: false
@ -164,7 +164,7 @@ endpoints:
name: os
description: 'The os of the server'
required: true
example: aut
example: vel
type: string
enumValues: []
exampleWasSpecified: false
@ -186,7 +186,7 @@ endpoints:
name: database
description: Database
required: true
example: postgresql13
example: mysql80
type: string
enumValues:
- none
@ -207,7 +207,7 @@ endpoints:
name: php
description: 'PHP version'
required: true
example: '7.4'
example: '7.2'
type: string
enumValues:
- '7.0'
@ -223,22 +223,22 @@ endpoints:
nullable: false
custom: []
cleanBodyParameters:
provider: ut
server_provider: hetzner
region: consectetur
provider: fugiat
server_provider: digitalocean
region: itaque
plan: voluptatum
ip: quisquam
port: sapiente
name: itaque
os: aut
ip: ut
port: reiciendis
name: et
os: vel
webserver: nginx
database: postgresql13
php: '7.4'
database: mysql80
php: '7.2'
fileParameters: []
responses:
-
status: 200
content: '{"id":null,"project_id":null,"user_id":null,"provider_id":null,"name":"Sidney Grant","ssh_user":"vito","ip":"22.232.10.97","local_ip":"107.107.187.150","port":22,"os":"ubuntu_22","type":"regular","type_data":null,"provider":"custom","provider_data":null,"public_key":"test","status":"ready","auto_update":null,"available_updates":0,"security_updates":null,"progress":100,"progress_step":null,"updates":null,"last_update_check":null,"created_at":null,"updated_at":null}'
content: '{"id":null,"project_id":null,"user_id":null,"provider_id":null,"name":"Jeromy Mann","ssh_user":"vito","ip":"128.70.209.89","local_ip":"150.217.250.187","port":22,"os":"ubuntu_22","type":"regular","type_data":null,"provider":"custom","provider_data":null,"public_key":"test","status":"ready","auto_update":null,"available_updates":0,"security_updates":null,"progress":100,"progress_step":null,"updates":null,"last_update_check":null,"created_at":null,"updated_at":null}'
headers: []
description: ''
custom: []
@ -246,7 +246,7 @@ endpoints:
auth:
- headers
- Authorization
- 'Bearer Pg86vcedaD3V5EbZh4a61fk'
- 'Bearer 5E61e4vfcgDbVkZd68aah3P'
controller: null
method: null
route: null
@ -300,7 +300,7 @@ endpoints:
responses:
-
status: 200
content: '{"id":null,"project_id":null,"user_id":null,"provider_id":null,"name":"Maria Zemlak","ssh_user":"vito","ip":"4.166.233.247","local_ip":"92.197.44.184","port":22,"os":"ubuntu_22","type":"regular","type_data":null,"provider":"custom","provider_data":null,"public_key":"test","status":"ready","auto_update":null,"available_updates":0,"security_updates":null,"progress":100,"progress_step":null,"updates":null,"last_update_check":null,"created_at":null,"updated_at":null}'
content: '{"id":null,"project_id":null,"user_id":null,"provider_id":null,"name":"Miss Maya Schaden I","ssh_user":"vito","ip":"44.57.83.39","local_ip":"46.22.92.58","port":22,"os":"ubuntu_22","type":"regular","type_data":null,"provider":"custom","provider_data":null,"public_key":"test","status":"ready","auto_update":null,"available_updates":0,"security_updates":null,"progress":100,"progress_step":null,"updates":null,"last_update_check":null,"created_at":null,"updated_at":null}'
headers: []
description: ''
custom: []
@ -308,7 +308,7 @@ endpoints:
auth:
- headers
- Authorization
- 'Bearer ka4ebad163EchfgV6v8ZP5D'
- 'Bearer hV3debf65aPD4E1ckag8Z6v'
controller: null
method: null
route: null
@ -370,7 +370,7 @@ endpoints:
auth:
- headers
- Authorization
- 'Bearer VP68EZbe351gf64avDdhkac'
- 'Bearer b61aD6538PacZEkeghfvV4d'
controller: null
method: null
route: null
@ -432,7 +432,7 @@ endpoints:
auth:
- headers
- Authorization
- 'Bearer 64dDea1v3g6aVZc5b8fEkPh'
- 'Bearer dEZaa6cePVf3k86g45vbD1h'
controller: null
method: null
route: null
@ -494,7 +494,7 @@ endpoints:
auth:
- headers
- Authorization
- 'Bearer 5Pg3vec6Zbh1f8VD6Ea4dak'
- 'Bearer 6aDkZEfdP16V58gb43avhec'
controller: null
method: null
route: null