https://github.com/brokenhandsio/steampress-fluent-mysql
Fluent MySQL adapters for SteamPress
https://github.com/brokenhandsio/steampress-fluent-mysql
Last synced: 11 months ago
JSON representation
Fluent MySQL adapters for SteamPress
- Host: GitHub
- URL: https://github.com/brokenhandsio/steampress-fluent-mysql
- Owner: brokenhandsio
- License: mit
- Created: 2019-12-23T14:55:36.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-18T15:01:39.000Z (about 6 years ago)
- Last Synced: 2025-07-17T18:54:22.060Z (11 months ago)
- Language: Swift
- Size: 37.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Steampress Fluent MySQL provides Fluent MySQL adapters for SteamPress to allow you to use SteamPress with a MySQL database.
# Usage:
Add the package to your **Package.swift** dependencies:
```swift
dependencies: [
...,
.package(name: "SteampressFluentMysql", url: "https://github.com/brokenhandsio/steampress-fluent-mysql.git", from: "1.0.0"),
]
```
In **configure.swift** add the SteamPress Fluent MySQL provider:
```swift
import SteampressFluentMysql
// ...
let provider = SteamPressFluentMysqlProvider()
try services.register(provider)
```
You also need to add the migrations for the different database models to your `MigrationConfig`:
```swift
var migrations = MigrationConfig()
// ...
migrations.add(model: BlogTag.self, database: .mysql)
migrations.add(model: BlogUser.self, database: .mysql)
migrations.add(model: BlogPost.self, database: .mysql)
migrations.add(model: BlogPostTagPivot.self, database: .mysql)
// This will create an admin user so you can log in! The password will be printed out when created.
migrations.add(migration: BlogAdminUser.self, database: .mysql)
services.register(migrations)
```
This ensures the tables are created for use next time your app boots up.
For details on how to use SteamPress and the required templates see the main [SteamPress README](https://github.com/brokenhandsio/SteamPress/blob/master/README.md).
## Configuration
You can configure the provider with the following optional configuration options:
* `blogPath` - the path to add the blog to. For instance, if you pass in `"blog"`, your blog will be accessible at http://mysite.com/blog/, or leave this out your blog will be added to the root of your site (i.e. http://mysite.com/)
* `feedInformation`: Information to vend to the RSS and Atom feeds. Defaults to empty information.
* `postsPerPage`: The number of posts to show per page on the main index page of the blog and the user and tag pages. Defaults to 10.
* `enableAuthorsPages`: Flag used to determine whether to publicly expose the authors endpoints or not. Defaults to true.
* `enableTagsPages`: Flag used to determine whether to publicy expose the tags endpoints or not. Defaults to true.