Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(asb): allow config overrides from env vars #1231

Merged
merged 2 commits into from
Dec 9, 2022

Conversation

delta1
Copy link
Collaborator

@delta1 delta1 commented Dec 3, 2022

This change allows the ASB config to be overridden by env vars starting with ASB__.
Adds a test to check this, and updates the de/serialization of the network listen and external_addresses fields to be a comma separated string from the environment. The separator is a pair of underscores, which is necessary since some of the fields already have underscores in their names.

Example env var: ASB__NETWORK__EXTERNAL_ADDRESSES="/dns4/example.org/tcp/9939,/ip4/1.2.3.4/tcp/9940"

This particular change will help when running the ASB as a docker container (wip), allowing the config to be set in the env for docker-compose etc.

swap/src/asb/config.rs Outdated Show resolved Hide resolved
@delta1 delta1 marked this pull request as ready for review December 5, 2022 08:05
@binarybaron
Copy link
Collaborator

binarybaron commented Dec 5, 2022

Code lgtm but I'll try it out myself later.

Also if you are trying to create a docker image for the asb perhaps you can use the image I'm currently using as a starting point.

FROM rust:1.59-slim AS builder

WORKDIR /build

RUN apt-get update
RUN apt-get install -y git clang cmake libsnappy-dev

RUN git clone https://github.com/comit-network/xmr-btc-swap .

RUN cargo build --release --bin=asb

FROM debian:bullseye-slim

WORKDIR /data

COPY --from=builder /build/target/release/asb /bin/asb

# Expose listen address
EXPOSE 9939 9940

ENTRYPOINT ["asb"]

@delta1 delta1 marked this pull request as draft December 5, 2022 08:32
@delta1
Copy link
Collaborator Author

delta1 commented Dec 5, 2022

Cheers @binarybaron just finishing this up. Thanks for the dockerfile will compare with the one I have from much earlier this year 😅

- upgrades config crate to 0.13.2 comit-network#1087
- adds environment source for config overrides
@delta1 delta1 marked this pull request as ready for review December 5, 2022 09:28
@delta1
Copy link
Collaborator Author

delta1 commented Dec 9, 2022

bors r+

@bors bors bot merged commit ee4273d into comit-network:master Dec 9, 2022
@delta1 delta1 deleted the config-0.13.2 branch June 7, 2023 08:13
bors bot added a commit that referenced this pull request Aug 4, 2023
1417: feat(asb): allow asb to register with mulitple rendezvous nodes r=binarybaron a=delta1

implements #633  

This PR updates the ASB to be able to register with multiple rendezvous nodes. A unit test is added that checks this behaviour. I also tested it manually overnight and it repeatedly reregistered with the specified nodes.  

The config file option is left as `rendezvous_point` for backwards compatibility, but now uses the same deserialization as introduced in #1231 so that multiple addresses can be specified in a comma separated string, or as a toml array of strings.

Co-authored-by: Byron Hambly <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants