Skip to content

Commit

Permalink
DOC Quote all yaml service definitions (#285)
Browse files Browse the repository at this point in the history
Strings starting with a `%` must be explicitly quoted in YAML.
  • Loading branch information
GuySartorelli committed Jun 14, 2023
1 parent 3068943 commit 362f86d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions en/02_Developer_Guides/01_Templates/03_Requirements.md
Expand Up @@ -275,7 +275,7 @@ SilverStripe\Core\Injector\Injector:
SilverStripe\Assets\Storage\GeneratedAssetHandler.custom-generated-assets:
class: SilverStripe\Assets\Flysystem\GeneratedAssets
properties:
Filesystem: %$League\Flysystem\Filesystem.custom-filesystem
Filesystem: '%$League\Flysystem\Filesystem.custom-filesystem'
# Assign this generator to the requirements builder
SilverStripe\View\Requirements_Backend:
properties:
Expand Down Expand Up @@ -370,7 +370,7 @@ SilverStripe\Core\Injector\Injector:
SilverStripe\View\Requirements_Backend:
properties:
MinifyCombinedFiles: true
Minifier: %$MyProject\MyMinifier
Minifier: '%$MyProject\MyMinifier'
```

[alert]
Expand Down
8 changes: 4 additions & 4 deletions en/02_Developer_Guides/05_Extending/05_Injector.md
Expand Up @@ -316,12 +316,12 @@ name: MyController
---
App\MyController:
dependencies:
permissions: %$App\PermissionService
permissions: '%$App\PermissionService'
SilverStripe\Core\Injector\Injector:
App\PermissionService:
class: App\RestrictivePermissionService
properties:
database: %$App\MySQLDatabase
database: '%$App\MySQLDatabase'
App\MySQLDatabase:
constructor:
0: 'dbusername'
Expand Down Expand Up @@ -432,7 +432,7 @@ SilverStripe\Core\Injector\Injector:
class: App\JSONServiceImplementor
properties:
Serialiser: App\JSONSerialiser
App\GZIPJSONProvider: %$App\JSONServiceDefinition
App\GZIPJSONProvider: '%$App\JSONServiceDefinition'
```

`Injector::inst()->get(GZIPJSONProvider::class)` will then be an instance of `App\JSONServiceImplementor` with the injected
Expand All @@ -448,7 +448,7 @@ SilverStripe\Core\Injector\Injector:
App\Connector:
properties:
AsString: true
App\ServiceConnector: %$Connector
App\ServiceConnector: '%$Connector'
```

Both `App\Connector` and `App\ServiceConnector` will have the `AsString` property set to true, but the resulting
Expand Down
12 changes: 6 additions & 6 deletions en/02_Developer_Guides/05_Extending/06_Aspects.md
Expand Up @@ -106,7 +106,7 @@ Next, this should be bound into an instance of the `Aspect` class
SilverStripe\Core\Injector\Injector:
MySQLWriteDbAspect:
properties:
writeDb: %$WriteMySQLDatabase
writeDb: '%$WriteMySQLDatabase'
```

Next, we need to define the database connection that will be used for all non-write queries
Expand Down Expand Up @@ -135,10 +135,10 @@ SilverStripe\Core\Injector\Injector:
MySQLDatabase:
class: AopProxyService
properties:
proxied: %$ReadMySQLDatabase
proxied: '%$ReadMySQLDatabase'
beforeCall:
query:
- %$MySQLWriteDbAspect
- '%$MySQLWriteDbAspect'
```

The two important parts here are in the `properties` declared for the object.
Expand All @@ -163,7 +163,7 @@ SilverStripe\Core\Injector\Injector:
database: read_database
MySQLWriteDbAspect:
properties:
writeDb: %$WriteMySQLDatabase
writeDb: '%$WriteMySQLDatabase'
WriteMySQLDatabase:
class: MySQLDatabase
constructor:
Expand All @@ -175,10 +175,10 @@ SilverStripe\Core\Injector\Injector:
MySQLDatabase:
class: AopProxyService
properties:
proxied: %$ReadMySQLDatabase
proxied: '%$ReadMySQLDatabase'
beforeCall:
query:
- %$MySQLWriteDbAspect
- '%$MySQLWriteDbAspect'
```

## Changing what a method returns
Expand Down
8 changes: 4 additions & 4 deletions en/02_Developer_Guides/09_Security/03_Authentication.md
Expand Up @@ -71,7 +71,7 @@ SilverStripe\Core\Injector\Injector:
SilverStripe\Security\Security:
properties:
Authenticators:
myauthenticator: %$MyVendor\MyProject\Authenticator\MyAuthenticator
myauthenticator: '%$MyVendor\MyProject\Authenticator\MyAuthenticator'
```
If there is no authenticator registered, `Authenticator` will try to fall back on the default provided authenticator (`default`), which can be changed using the following config, replacing the MemberAuthenticator with your authenticator:
```yaml
Expand All @@ -84,7 +84,7 @@ SilverStripe\Core\Injector\Injector:
SilverStripe\Security\Security:
properties:
Authenticators:
default: %$MyVendor\MyProject\Authenticator\MyAuthenticator
default: '%$MyVendor\MyProject\Authenticator\MyAuthenticator'
```

By default, the `SilverStripe\Security\MemberAuthenticator\MemberAuthenticator` is seen as the default authenticator until it's explicitly set in the config.
Expand Down Expand Up @@ -136,12 +136,12 @@ SilverStripe\Core\Injector\Injector:
properties:
LDAPSettings:
- URL: https://my-ldap-location.com
CascadeInTo: %$SilverStripe\Security\MemberAuthenticator\SessionAuthenticationHandler
CascadeInTo: '%$SilverStripe\Security\MemberAuthenticator\SessionAuthenticationHandler'
SilverStripe\Security\AuthenticationHandler:
class: SilverStripe\Security\RequestAuthenticationHandler
properties:
Handlers:
ldap: %$MyProject\LDAP\Authenticator\LDAPAuthenticator
ldap: '%$MyProject\LDAP\Authenticator\LDAPAuthenticator'
```

CascadeInTo is used to defer login or logout actions to other authenticators, after the first one has been logged in. In the example of LDAP authenticator, this is useful to check e.g. the validity of the Session (is the user still logged in?) and if not, or it's LDAP login period has expired, only then validate against the external service again, limiting the amount of requests to the external service.
Expand Down
2 changes: 1 addition & 1 deletion en/02_Developer_Guides/09_Security/05_Rate_Limiting.md
Expand Up @@ -53,7 +53,7 @@ Or if you want to apply your middleware to a specific route:
SilverStripe\Control\Director:
rules:
special/section:
Controller: %$MyRateLimitedController
Controller: '%$MyRateLimitedController'
```

## Applying rate limiting across an entire application
Expand Down

0 comments on commit 362f86d

Please sign in to comment.