Skip to content
This repository was archived by the owner on Mar 7, 2025. It is now read-only.

Commit 66572e9

Browse files
committed
Documentation for configs management
1 parent 5cbcb91 commit 66572e9

File tree

4 files changed

+78
-1
lines changed

4 files changed

+78
-1
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

77
## [Unreleased]
8+
### Added
9+
- Configuration (nginx and ENV) files management;
810

911
## [1.0.1] - 2017-03-14
1012
### Added

docs/config-files.md

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Overview
2+
3+
SDK provides Configs Manager that allows you to view and edit NGINX and ENV configuration files for your sites.
4+
5+
# Usage
6+
7+
Documentation assumes that you've already retrieved site instance from `SitesManager` class.
8+
9+
All operations are performed via `Laravel\Forge\Configs\ConfigsManager` instance.
10+
11+
## Get Nginx configuration
12+
13+
```php
14+
<?php
15+
16+
use Laravel\Forge\Configs\ConfigsManager;
17+
18+
$configs = new ConfigsManager();
19+
$nginxConfiguration = $configs->get('nginx')->from($site);
20+
```
21+
22+
The value of `$nginxConfiguration` is actual content of your nginx configuration file.
23+
24+
## Update Nginx configuration
25+
26+
```php
27+
<?php
28+
29+
use Laravel\Forge\Configs\ConfigsManager;
30+
31+
$configs = new ConfigsManager();
32+
33+
// Load new configuration file from appropirate source.
34+
$configuration = file_get_contents('nginx.conf');
35+
36+
if ($configs->update('nginx', $configuration)->on($site)) {
37+
echo 'Nginx configuration on '.$site->domain().' site was updated.';
38+
}
39+
```
40+
41+
## Get ENV configuration
42+
43+
ENV confguration stored in `.env` file of your application.
44+
45+
```php
46+
<?php
47+
48+
use Laravel\Forge\Configs\ConfigsManager;
49+
50+
$configs = new ConfigsManager();
51+
52+
$env = $configs->get('env')->from($site);
53+
```
54+
55+
The value of `$env` is actual content of your `.env` configuration file.
56+
57+
## Update ENV configuration
58+
59+
```php
60+
<?php
61+
62+
use Laravel\Forge\Configs\ConfigsManager;
63+
64+
$configs = new ConfigsManager();
65+
66+
// Load new configuration file from appropirate source.
67+
$configuration = file_get_contents('.env');
68+
69+
if ($configs->update('env', $configuration)->on($site)) {
70+
echo 'ENV configuration on '.$site->domain().' site was updated.';
71+
}
72+
```
73+
74+
[Back to Table of Contents](./readme.md)

docs/getting-started.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ This SDK supports following Forge API features:
1212
- Services management - install, uninstall, reboot & stop nginx, MySQL, Postgres and other services;
1313
- MySQL databases & users;
1414
- Sites & applications management;
15+
- Site configuration (`nginx.conf` & `.env` files);
1516
- Deployment management - enable to disable quick deployment, view logs, edit deployment script & deploy-on-demand;
1617
- SSH keys;
1718
- Daemons;
@@ -22,7 +23,6 @@ This SDK supports following Forge API features:
2223
## Coming soon
2324

2425
- SSL certificates management;
25-
- Services configuration;
2626
- Recipes.
2727

2828
# Requirements

docs/readme.md

+1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
- [Firewall Rules](./firewall-rules.md)
1414
- [Sites](./sites.md)
1515
+ [Site Applications](./site-applications.md)
16+
+ [Configuration Files](./config-files.md)
1617
+ [Deployment](./deployment.md)
1718
+ [Workers](./workers.md)

0 commit comments

Comments
 (0)