Skip to content

Commit

Permalink
document GoAWSConfig (#6)
Browse files Browse the repository at this point in the history
* document GoAWSConfig

* fix syntax highlighting
  • Loading branch information
ericphanson authored Nov 15, 2023
1 parent f717ecd commit ec3c446
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Documentation for [GoAWS](https://github.com/ericphanson/GoAWS.jl).
## Configuration

To configure the server, pass `config`. It is suggested to modify the default config, for example:
```

```julia
config = GoAWS.default_config()
config["Local"]["LogToFile"] = true
server = Server(; config)
Expand Down
37 changes: 37 additions & 0 deletions src/aws_interop.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
"""
GoAWSConfig <: AWS.AbstractAWSConfig
GoAWSConfig(; endpoint=GoAWS.DEFAULT_ADDRESS, region="us-east-2")
GoAWSConfig(s::Server)
Constructs an `AbstractAWSConfig` for use with AWS.jl, to configure
SQS and SNS to use GoAWS.
## Examples
Here we demonstrate using the config with a local server we launch
as a subprocess.
```julia
using GoAWS, AWS
@service SQS
server = GoAWS.Server()
aws_config = GoAWSConfig(server)
run(server; wait=false)
# ... now we can use the config:
SQS.create_queue("my_queue"; aws_config)
kill(server) # when you are done
```
One can also use a `GoAWSConfig` with a GoAWS server launched outside
of the Julia process. Simply set the `endpoint` and `region` using the
keyword argument constructor:
```julia
aws_config = GoAWSConfig(; endpoint="localhost:5203", region="us-east-1")
# ... now we can use the config:
SQS.create_queue("my_queue"; aws_config)
```
"""
struct GoAWSConfig <: AWS.AbstractAWSConfig
endpoint::URI
region::String
Expand Down

0 comments on commit ec3c446

Please sign in to comment.