Skip to content

Commit 3c23b5b

Browse files
Merge pull request #8 from AndreasAakesson/master
Support new config structure
2 parents ae2f91d + 20e1cbf commit 3c23b5b

4 files changed

Lines changed: 8 additions & 27 deletions

File tree

register_plugin.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717

1818
#include "ws_uplink.hpp"
1919
#include "common.hpp"
20-
21-
#include <net/autoconf.hpp>
2220
#include <os>
2321

2422
namespace uplink {
@@ -37,8 +35,6 @@ void setup_uplink()
3735
MYINFO("Setting up WS uplink");
3836

3937
try {
40-
net::autoconf::load();
41-
4238
auto& en0 = net::Super_stack::get<net::IP4>(0);
4339

4440
uplink = std::make_unique<WS_uplink>(en0);

starbase/CMakeLists.txt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ include($ENV{INCLUDEOS_PREFIX}/includeos/pre.service.cmake)
1010

1111

1212
# Name of your project
13-
project (seed)
13+
project (starbase)
1414

1515
# Human-readable name of your service
1616
set(SERVICE_NAME "IncludeOS Starbase")
@@ -39,16 +39,13 @@ set(SOURCES
3939
# DRIVERS / PLUGINS:
4040

4141
set(DRIVERS
42-
virtionet # Virtio networking
42+
virtionet
4343
vmxnet3
44-
# virtioblock # Virtio block device
45-
# ... Others from IncludeOS/src/drivers
4644
)
4745

4846
set(PLUGINS
49-
# syslogd # Syslog over UDP
50-
# ...others
5147
uplink
48+
autoconf
5249
)
5350

5451
# THIRD PARTY LIBRARIES:

ws_uplink.cpp

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#include "ws_uplink.hpp"
1919
#include "common.hpp"
2020

21-
#include <memdisk>
22-
2321
#ifndef RAPIDJSON_HAS_STDSTRING
2422
#define RAPIDJSON_HAS_STDSTRING 1
2523
#endif
@@ -37,6 +35,7 @@
3735
#include <hw/pci_device.hpp>
3836
#include <kernel/cpuid.hpp>
3937
#include <statman>
38+
#include <config>
4039

4140
namespace uplink {
4241

@@ -264,24 +263,13 @@ namespace uplink {
264263

265264
void WS_uplink::read_config()
266265
{
267-
MYINFO("Reading uplink config from %s", UPLINK_CFG_FILE.c_str());
268-
auto& disk = fs::memdisk();
269-
270-
if (not disk.fs_ready())
271-
{
272-
disk.init_fs([] (auto err, auto&) {
273-
Expects(not err && "Error occured when mounting FS.");
274-
});
275-
}
276-
277-
auto cfg = disk.fs().stat(UPLINK_CFG_FILE); // name hardcoded for now
266+
MYINFO("Reading uplink config");
278267

279-
Expects(cfg.is_file() && "File not found.");
280-
Expects(cfg.size() && "File is empty.");
268+
const auto& cfg = ::Config::get();
281269

282-
auto content = cfg.read();
270+
Expects(not cfg.empty() && "Config is empty");
283271

284-
parse_config(content);
272+
parse_config({cfg.data(), cfg.size()});
285273
}
286274

287275
void WS_uplink::parse_config(const std::string& json)

0 commit comments

Comments
 (0)