Skip to content

Commit 6982d92

Browse files
committed
Update to readme
1 parent f9766a3 commit 6982d92

1 file changed

Lines changed: 59 additions & 1 deletion

File tree

README.md

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,60 @@
11
# ApplicationConfiguration
2-
A simple and codable way to configure a Perfect Application
2+
A simple and codable way to configure a Perfect Application.
3+
4+
** This module is a part of PerfectAcelerators brought to you by the Perfect Community!**
5+
6+
## Installation
7+
Using Swift Package Manager, add the following to your packages.swift
8+
9+
`.package(url: "https://github.com/PerfectAccelerators/ApplicationConfiguration.git", .branch("master"))`
10+
11+
Run `swift package update` and if you use Xcode run `swift package generate-xcodeproj`
12+
## Usage
13+
Create a file that includes the configuration for your application, for instance:
14+
{
15+
"server": {
16+
"baseURL": "localhost:8181",
17+
"baseDomain": "localhost",
18+
"port": 8181,
19+
"secure": 0
20+
},
21+
"os": 2,
22+
"environment": 1,
23+
"ssl": {
24+
"port": 443,
25+
"originCertificatePath": "",
26+
"privateKeyPath": "",
27+
"verifyMode": "peer"
28+
},
29+
"logging": {
30+
"requestLoggingPath": "./perfectRequests.log",
31+
"logPath": "./perfect.log"
32+
},
33+
"db": {
34+
"name": "perfect",
35+
"host": "localhost",
36+
"port": 3306,
37+
"user": "",
38+
"pass": "",
39+
"driverType": 1
40+
}
41+
}
42+
43+
Then modify your main.swift:
44+
import ApplicationConfiguration
45+
46+
#if os(Linux)
47+
let fileRoot = "/perfect-deployed/Perfect/"
48+
let filePath = "./config/ApplicationConfigurationLinux.json"
49+
#endif
50+
51+
let app = Application(name: "Perfect", path: filePath)
52+
53+
do {
54+
try HTTPServer.launch(app.server())
55+
} catch {
56+
fatalError("\(error)")
57+
}
58+
59+
## Contributing
60+
To contribute a feature or idea to **ApplicationConfiguration**, fork the project, make your changes and submit a pull request :)

0 commit comments

Comments
 (0)