Skip to content

Commit

Permalink
refactor config.py
Browse files Browse the repository at this point in the history
This commit introduces new class "ConfigLoader". So the "Config" instance will delegate file loading to a "ConfigLoader" instance which is good for unit tests. This commit also removes external nodes.json file. Because this file could introduce version divergence when running mainnet on master.
  • Loading branch information
reliveyy committed Apr 7, 2020
1 parent 3943ce0 commit c6e0cbf
Show file tree
Hide file tree
Showing 8 changed files with 263 additions and 279 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- docker
before_script:
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
- pip install pexpect docker pytest
- pip install -r requirements-dev.txt
script: tools/push --no-manifest-list
jobs:
include:
Expand Down
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ git checkout -b your-feature-branch

Make your desired changes to the images located at: `$PROJECT_DIR/images`.

Build your modified images. Optionally modify the `nodes.json` in the project root if necessary.
Build your modified images.

```bash
tools/build
Expand All @@ -34,13 +34,7 @@ tools/build
Test it locally.

```bash
./xud.sh -b your-feature-branch
```

or

```bash
./xud.sh -b your-feature-branch --nodes-json ./nodes.json
bash setup.sh -b your-feature-branch
```

To let others test without building the images by themselves push your feature branch to remote repository. Travis will build & push images for you.
Expand Down
5 changes: 3 additions & 2 deletions images/utils/launcher/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from shutil import copyfile
import traceback

from .config import Config, ArgumentError, InvalidHomeDir, InvalidNetworkDir
from .config import Config, ConfigLoader, ArgumentError, InvalidHomeDir, InvalidNetworkDir
from .shell import Shell
from .node import NodeManager, NodeNotFound, ImagesNotAvailable
from .utils import ParallelExecutionError, get_hostfs_file
Expand Down Expand Up @@ -133,7 +133,8 @@ def launch(self):
exit_code = 0
config = None
try:
config = Config()
config = Config(ConfigLoader())
assert config.network_dir is not None
shell.set_network_dir(config.network_dir) # will create shell history file in network_dir
env = XudEnv(config, shell)
env.start()
Expand Down
2 changes: 1 addition & 1 deletion images/utils/launcher/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
from .config import Config, ArgumentParser, ArgumentError, InvalidHomeDir, \
InvalidNetworkDir, PortPublish
InvalidNetworkDir, PortPublish, ConfigLoader
Loading

0 comments on commit c6e0cbf

Please sign in to comment.