//
//  Licensed to the Apache Software Foundation (ASF) under one or more
//  contributor license agreements.  See the NOTICE file distributed with
//  this work for additional information regarding copyright ownership.
//  The ASF licenses this file to You under the Apache License, Version 2.0
//  (the "License"); you may not use this file except in compliance with
//  the License.  You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//

== Setting up for development.

1. Install StreamPipes (Using `./streampipes start` with the installer, choosing a real IP address)
2. When asked for the IP address, enter: `host.docker.internal`
3. Edit your `hosts` file (Mac: `/private/ect/hosts`) to direct `host.docker.internal` to `127.0.0.1_`

== Setting up the Worker

1. Make sure the `EnvFile` plugin is installed in IntelliJ
2. Create a new `Application` run configuration targeting the `BacNetIpAdapter.BacNetIpAdapterInit` class
3. Go to the run-configuration and select the `EnvFile` tab
4. Check the `Enable EnvFile`
5. Add the env file in `env/development`

== Running the Worker

1. Execute the new run configuration (This will fail with an error: `Web server failed to start. Port 8098 was already in use.`)
2. Stop the running configuration.
3. Go to the `Consul` configuration page on `http://localhost:8500`
4. Select `Key/Value`
5. Navigate to `sp/v1/{name of your worker}
6. Change `SP_CONNECT_CONTAINER_WORKER_PORT` to an unused port: `8198`
7. Change `SP_CONNECT_CONTAINER_WORKER_HOST` and `SP_KAFKA_HOST` from `localhost` to the fixed ip you told the setup to use
8. Restart the run configuration

== Using the Worker

1. Go to the StreamPipes UI section `StreamPipes connect`
2. Search for your Worker
3. Give it a name
4. Start it
5. Now it should appear in the `Data Streams` section of the pipeline editor