Skip to content

Commit 2c221da

Browse files
committed
refactor: update default server configuration values and improve documentation
1 parent 3b557e7 commit 2c221da

File tree

3 files changed

+36
-11
lines changed

3 files changed

+36
-11
lines changed

README.md

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,26 @@ will be prompted to provide the required values, which will be saved locally.
4747
```
4848

4949
- `databaseUrl`: The database URL (without username or password).
50-
- `databaseUser`: The username for your database.
51-
- `databasePassword`: The password for your database.
52-
- `hostAddress`: The host address of the server. If not provided, defaults to `0.0.0.0`.
53-
- `serverPort`: The port number on which the server runs. If not provided, defaults to `8080`.
50+
- `databaseUrl` should always start with the name of the database you're using:
51+
- PGSQL (or) PostgreSQL :
52+
```
53+
postgresql://someAddress:port/linkora
54+
```
55+
- MySQL :
56+
```
57+
mysql://someAddress:port/linkora
58+
```
59+
- SQLite :
60+
```
61+
sqlite:path-to-db
62+
```
63+
`path-to-db` should look something like `sqlite:/home/saketh/Documents/sqlite/databaseFileName`
64+
- `databaseUser`: The username of the database you want to connect to.
65+
- If you are using SQLite, leave this blank or press Enter when the setup prompts for it.
66+
- `databasePassword`: The password of the database you want to connect to.
67+
- If you are using SQLite, leave this blank or press Enter when the setup prompts for it.
68+
- `hostAddress`: The host address of the server. If not provided, it defaults to the `IPv4` of the network currently connected to. When connecting from Linkora apps, you should pass this address instead of `localhost`.
69+
- `serverPort`: The port number on which the server runs. If not provided, defaults to `45454`.
5470
- `serverAuthToken`: A secure token used to authenticate requests from the Linkora app. Treat this like a password and
5571
keep it confidential.
5672
@@ -65,13 +81,15 @@ set:
6581
6682
- `LINKORA_SERVER_USE_ENV_VAL`: Set this to `true` to enable the use of environment variables. This must always be `true` when using environment variables.
6783
- `LINKORA_DATABASE_URL`: The database URL (without username or password).
68-
- `LINKORA_DATABASE_USER`: The username for your database.
69-
- `LINKORA_DATABASE_PASSWORD`: The password for your database.
84+
- `LINKORA_DATABASE_USER`: The username of the database you want to connect to.
85+
- If you are using SQLite, leave this blank.
86+
- `LINKORA_DATABASE_PASSWORD`: The password of the database you want to connect to.
87+
- If you are using SQLite, leave this blank.
7088
- `LINKORA_SERVER_AUTH_TOKEN`: A secure token used to authenticate requests from the Linkora app. Treat this like a
7189
password and
7290
keep it confidential.
73-
- `LINKORA_HOST_ADDRESS`: The host address of the server. If not provided, defaults to `0.0.0.0`.
74-
- `LINKORA_SERVER_PORT`: The port number on which the server runs. If not provided, defaults to `8080`.
91+
- `LINKORA_HOST_ADDRESS`: The host address of the server. If not provided, it defaults to the `IPv4` of the network currently connected to. When connecting from Linkora apps, you should pass this address instead of `localhost`.
92+
- `LINKORA_SERVER_PORT`: The port number on which the server runs. If not provided, defaults to `45454`.
7593
7694
### 3. Hosting Options
7795
@@ -145,6 +163,12 @@ authentication details.
145163
- For local hosting with Docker, use the provided `docker run` command with environment variables.
146164
- For remote hosting, use the environment variable service provided by your cloud hosting provider.
147165
166+
#### Workflow of Linkora, which should make it easier to understand how everything works:
167+
168+
<a href="https://github.com/user-attachments/assets/bb2d9b7e-92c4-41ed-82d3-ad821cc65638" onclick="window.open(this.href, '_blank'); return false;">
169+
<img alt="linkora-outline.png" src="https://github.com/user-attachments/assets/bb2d9b7e-92c4-41ed-82d3-ad821cc65638" style="max-width: 100%; height: auto;">
170+
</a>
171+
148172
### Join the Community
149173
150174
[![Join us on Discord](https://discord.com/api/guilds/1214971383352664104/widget.png?style=banner2)](https://discord.gg/ZDBXNtv8MD)

src/main/kotlin/com/sakethh/linkora/Application.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import io.ktor.server.websocket.*
1616
import kotlinx.serialization.encodeToString
1717
import kotlinx.serialization.json.Json
1818
import java.awt.Desktop
19+
import java.net.InetAddress
1920
import java.net.URI
2021
import java.nio.file.Files
2122
import java.nio.file.Paths
@@ -91,11 +92,11 @@ object ServerConfiguration {
9192
// manually throw the exception as `getenv` may return null, and no conversion is happening here to auto-throw
9293
System.getenv(SysEnvKey.LINKORA_HOST_ADDRESS.name) ?: throw NullPointerException()
9394
} catch (_: Exception) {
94-
"0.0.0.0"
95+
InetAddress.getLocalHost().hostAddress
9596
}, serverPort = try {
9697
System.getenv(SysEnvKey.LINKORA_SERVER_PORT.name).toInt()
9798
} catch (_: Exception) {
98-
8080
99+
45454
99100
},
100101
serverAuthToken = System.getenv(SysEnvKey.LINKORA_SERVER_AUTH_TOKEN.name)
101102
)

src/main/resources/raw/SERVER_IS_CONFIGURED.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
It seems you've correctly configured the sync-server.
1+
It seems you've configured the sync-server correctly; to check if it's running, browse to this endpoint or refresh—if the page loads again, the server is up; ensure the connected database is also running.
22

33
This server is meant to communicate only with the **[Linkora](https://github.com/LinkoraApp/Linkora)** apps, available on **Android** and **Desktop**. There's no web-based frontend yet, so you can’t control anything through a web interface. That said, if you’re willing to build your own custom solution from scratch that connects to this server and does what it needs to, then it’s totally possible.
44

0 commit comments

Comments
 (0)