Skip to content

Commit

Permalink
Drop config component (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blacksmoke16 authored Apr 7, 2024
1 parent 51f2321 commit 993b9c6
Show file tree
Hide file tree
Showing 48 changed files with 138 additions and 464 deletions.
1 change: 0 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ Athena is a collection of general-purpose, robust, independent, and reusable com
These include:

* [Clock](/Clock) (`ACLK`) - Decouples applications from the system clock
* [Config](/Config) (`ACF`) - Common library for configuring Athena components
* [Console](/Console) (`ACON`) - Allows the creation of CLI based commands
* [DependencyInjection](/DependencyInjection) (`ADI`) - Robust dependency injection service container framework
* [Dotenv](/Dotenv) - Registers environment variables from a `.env` file
Expand Down
6 changes: 3 additions & 3 deletions docs/getting_started/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ TIP: Parameters may also be [injected](/DependencyInjection/Register/#Athena::De

## Custom Annotations

Athena integrates the [Athena::Config](/Config) component's ability to define custom annotation configurations.
Athena integrates the [Athena::DependencyInjection](/DependencyInjection) component's ability to define custom annotation configurations.
This feature allows developers to define custom annotations, and the data that should be read off of them, then apply/access the annotations on [ATH::Controller](/Framework/Controller) and/or [ATH::Action](/Framework/Action)s.

This is a powerful feature that allows for almost limitless flexibility/customization.
Expand All @@ -191,7 +191,7 @@ require "athena"
# Define our configuration annotation with an optional `name` argument.
# A default value can also be provided, or made not nilable to be considered required.
ACF.configuration_annotation MyAnnotation, name : String? = nil
ADI.configuration_annotation MyAnnotation, name : String? = nil
# Define and register our listener that will do something based on our annotation.
@[ADI::Register]
Expand Down Expand Up @@ -243,7 +243,7 @@ A good example use case for custom annotations is the creation of a `Paginated`
# Define our configuration annotation with the default pagination values.
# These values can be overridden on a per endpoint basis.
ACF.configuration_annotation Paginated, page : Int32 = 1, per_page : Int32 = 100, max_per_page : Int32 = 1000
ADI.configuration_annotation Paginated, page : Int32 = 1, per_page : Int32 = 100, max_per_page : Int32 = 1000
# Define and register our listener that will handle paginating the response.
@[ADI::Register]
Expand Down
4 changes: 3 additions & 1 deletion docs/getting_started/middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ Another use case for this event is populating additional data into the request's

### 2. Action Event

The next event to be dispatched is the [ATH::Events::Action](/Framework/Events/Action/) event, assuming a response was not already returned within the [request](#1-request-event) event. This event is dispatched after the related controller/action pair is determined, but before it is executed. This event is intended to be used when a listener requires information from the related [ATH::Action](/Framework/Action/); such as reading custom annotations off of it via the [Config](./configuration.md) component.
The next event to be dispatched is the [ATH::Events::Action](/Framework/Events/Action/) event, assuming a response was not already returned within the [request](#1-request-event) event.
This event is dispatched after the related controller/action pair is determined, but before it is executed.
This event is intended to be used when a listener requires information from the related [ATH::Action](/Framework/Action/); such as reading [custom annotations](./configuration.md#custom-annotations).

!!! example "Action event in the Athena Framework"
This is the event that the [ATH::Listeners::ParamFetcher](/Framework/Listeners/ParamFetcher) listens on to resolve request parameters such as [ATHA::QueryParam](/Framework/Events/Annotations/QueryParam).
Expand Down
18 changes: 11 additions & 7 deletions docs/getting_started/routing.md
Original file line number Diff line number Diff line change
Expand Up @@ -521,13 +521,17 @@ class CSVFormatHandler
end
end
# Configure the format listener.
def ATH::Config::ContentNegotiation.configure
new(
# Allow json and csv formats, falling back on json if an unsupported format is requested.
Rule.new(priorities: ["json", "csv"], fallback_format: "json"),
)
end
ATH.configure({
framework: {
format_listener: {
enabled: true,
rules: [
# Allow json and csv formats, falling back on json if an unsupported format is requested.
{priorities: ["json", "csv"], fallback_format: "json"}
]
},
}
})
class ExampleController < ATH::Controller
@[ARTA::Get("/users")]
Expand Down
2 changes: 1 addition & 1 deletion docs/why_athena.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ require "athena"
# Define our configuration annotation with an optional `name` argument.
# A default value can also be provided, or made not nilable to be considered required.
ACF.configuration_annotation MyAnnotation, name : String? = nil
ADI.configuration_annotation MyAnnotation, name : String? = nil
# Define and register our listener that will do something based on our annotation.
@[ADI::Register]
Expand Down
1 change: 0 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ nav:
- API Reference:
- api_reference.md
- project://clock
- project://config
- project://console
- project://dependency_injection
- project://dotenv
Expand Down
1 change: 0 additions & 1 deletion scripts/diff.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ then
fi

diff clock
diff config
diff console
diff dependency-injection
diff dotenv
Expand Down
1 change: 0 additions & 1 deletion scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ function tag()
{
declare -A componentNameMap
componentNameMap[clock]=Clock
componentNameMap[config]=Config
componentNameMap[console]=Console
componentNameMap[dependency-injection]="Dependency Injection"
componentNameMap[dotenv]="Dotenv"
Expand Down
1 change: 0 additions & 1 deletion scripts/sync.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ function maybeSync()
}

maybeSync "src/components/clock" clock https://github.com/athena-framework/clock.git
maybeSync "src/components/config" config https://github.com/athena-framework/config.git
maybeSync "src/components/console" console https://github.com/athena-framework/console.git
maybeSync "src/components/dependency_injection" dependency-injection https://github.com/athena-framework/dependency-injection.git
maybeSync "src/components/dotenv" dotenv https://github.com/athena-framework/dotenv.git
Expand Down
2 changes: 0 additions & 2 deletions shard.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ dependencies:
path: ./src/components/framework
athena-clock:
path: ./src/components/clock
athena-config:
path: ./src/components/config
athena-console:
path: ./src/components/console
athena-dependency_injection:
Expand Down
2 changes: 0 additions & 2 deletions shard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ dependencies:
github: athena-framework/athena
athena-clock:
github: athena-framework/clock
athena-config:
github: athena-framework/config
athena-console:
github: athena-framework/console
athena-dependency_injection:
Expand Down
9 changes: 0 additions & 9 deletions src/components/config/.editorconfig

This file was deleted.

8 changes: 0 additions & 8 deletions src/components/config/.gitignore

This file was deleted.

75 changes: 0 additions & 75 deletions src/components/config/CHANGELOG.md

This file was deleted.

3 changes: 0 additions & 3 deletions src/components/config/CONTRIBUTING.md

This file was deleted.

21 changes: 0 additions & 21 deletions src/components/config/LICENSE

This file was deleted.

29 changes: 0 additions & 29 deletions src/components/config/README.md

This file was deleted.

Empty file.
31 changes: 0 additions & 31 deletions src/components/config/mkdocs.yml

This file was deleted.

17 changes: 0 additions & 17 deletions src/components/config/shard.yml

This file was deleted.

Loading

0 comments on commit 993b9c6

Please sign in to comment.