Search in sources :

Example 1 with Configuration

use of com.iota.iri.conf.Configuration in project iri by iotaledger.

the class IRI method main.

public static void main(final String[] args) throws IOException {
    configuration = new Configuration();
    validateParams(configuration, args);
    log.info("Welcome to {} {}", configuration.booling(DefaultConfSettings.TESTNET) ? TESTNET_NAME : MAINNET_NAME, VERSION);
    iota = new Iota(configuration);
    ixi = new IXI(iota);
    api = new API(iota, ixi);
    shutdownHook();
    if (configuration.booling(DefaultConfSettings.DEBUG)) {
        log.info("You have set the debug flag. To enable debug output, you need to uncomment the DEBUG appender in the source tree at iri/src/main/resources/logback.xml and re-package iri.jar");
    }
    if (configuration.booling(DefaultConfSettings.EXPORT)) {
        File exportDir = new File("export");
        // if the directory does not exist, create it
        if (!exportDir.exists()) {
            log.info("Create directory 'export'");
            try {
                exportDir.mkdir();
            } catch (SecurityException e) {
                log.error("Could not create directory", e);
            }
        }
        exportDir = new File("export-solid");
        // if the directory does not exist, create it
        if (!exportDir.exists()) {
            log.info("Create directory 'export-solid'");
            try {
                exportDir.mkdir();
            } catch (SecurityException e) {
                log.error("Could not create directory", e);
            }
        }
    }
    try {
        iota.init();
        api.init();
        ixi.init(configuration.string(Configuration.DefaultConfSettings.IXI_DIR));
    } catch (final Exception e) {
        log.error("Exception during IOTA node initialisation: ", e);
        System.exit(-1);
    }
    log.info("IOTA Node initialised correctly.");
}
Also used : Configuration(com.iota.iri.conf.Configuration) API(com.iota.iri.service.API) File(java.io.File) IOException(java.io.IOException)

Example 2 with Configuration

use of com.iota.iri.conf.Configuration in project iri by iotaledger.

the class NodeIntegrationTests method newNode.

private Iota newNode(int index, TemporaryFolder db, TemporaryFolder log) throws Exception {
    db.create();
    log.create();
    Configuration conf = new Configuration();
    Iota iota;
    conf.put(Configuration.DefaultConfSettings.PORT, String.valueOf(14800 + index));
    conf.put(Configuration.DefaultConfSettings.UDP_RECEIVER_PORT, String.valueOf(14700 + index));
    conf.put(Configuration.DefaultConfSettings.TCP_RECEIVER_PORT, String.valueOf(14700 + index));
    conf.put(Configuration.DefaultConfSettings.DB_PATH, db.getRoot().getAbsolutePath());
    conf.put(Configuration.DefaultConfSettings.DB_LOG_PATH, log.getRoot().getAbsolutePath());
    conf.put(Configuration.DefaultConfSettings.TESTNET, "true");
    iota = new Iota(conf);
    iota.init();
    return iota;
}
Also used : Configuration(com.iota.iri.conf.Configuration)

Aggregations

Configuration (com.iota.iri.conf.Configuration)2 API (com.iota.iri.service.API)1 File (java.io.File)1 IOException (java.io.IOException)1