services-gateway-runner/src/main/java/io/scalecube/services/gateway/GatewayRunner.java
/**
   * Main runner.
   *
   * @param args program arguments
   * @throws Exception exception thrown
   */
Main runner.
@param args program arguments
@throws Exception exception thrown
Main runner . @param args program arguments @throws Exception exception thrown
public static void main(String[] args) throws Exception {
    ConfigRegistry configRegistry = ConfigBootstrap.configRegistry();
    Config config =
        configRegistry
            .objectProperty("io.scalecube.services.gateway", Config.class)
            .value()
            .orElseThrow(() -> new IllegalStateException("Couldn't load config"));
    LOGGER.info(DECORATOR);
    LOGGER.info("Starting Gateway on {}", config);
    LOGGER.info(DECORATOR);
    MetricRegistry metrics = initMetricRegistry();
    Microservices.builder()
        .discovery(serviceEndpoint -> serviceDiscovery(serviceEndpoint, config))
        .transport(() -> newServiceTransport(config))
        .gateway(opts -> new WebsocketGateway(opts.id("ws").port(7070)))
        .gateway(
            opts ->
                new HttpGateway(opts.id("http").port(8080))
                    .corsEnabled(true)
                    .corsConfig(cors -> cors.allowedRequestHeaders("*")))
        .gateway(opts -> new RSocketGateway(opts.id("rsws").port(9090)))
        .metrics(metrics)
        .startAwait()
        .onShutdown()
        .block();
  }
public static void main ( String [ ] args ) throws Exception { ConfigRegistry configRegistry = ConfigBootstrap . configRegistry ( ) ; Config config = configRegistry . objectProperty ( "io.scalecube.services.gateway" , Config . class ) . value ( ) . orElseThrow ( ( ) -> new IllegalStateException ( "Couldn't load config" ) ) ; LOGGER . info ( DECORATOR ) ; LOGGER . info ( "Starting Gateway on {}" , config ) ; LOGGER . info ( DECORATOR ) ; MetricRegistry metrics = initMetricRegistry ( ) ; Microservices . builder ( ) . discovery ( serviceEndpoint -> serviceDiscovery ( serviceEndpoint , config ) ) . transport ( ( ) -> newServiceTransport ( config ) ) . gateway ( opts -> new WebsocketGateway ( opts . id ( "ws" ) . port ( 7070 ) ) ) . gateway ( opts -> new HttpGateway ( opts . id ( "http" ) . port ( 8080 ) ) . corsEnabled ( true ) . corsConfig ( cors -> cors . allowedRequestHeaders ( "*" ) ) ) . gateway ( opts -> new RSocketGateway ( opts . id ( "rsws" ) . port ( 9090 ) ) ) . metrics ( metrics ) . startAwait ( ) . onShutdown ( ) . block ( ) ; }
Main runner.
Main runner .