Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: thedevs-network/kutt
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v3.2.2
Choose a base ref
...
head repository: thedevs-network/kutt
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 12 commits
  • 2 files changed
  • 3 contributors

Commits on Jan 23, 2025

  1. Add Helm Chart

    christianhuth authored Jan 23, 2025
    Copy the full SHA
    59a3e4a View commit details

Commits on Jan 24, 2025

  1. add DB_FILENAME

    poeti8 authored Jan 24, 2025
    Copy the full SHA
    b851822 View commit details
  2. wording

    poeti8 authored Jan 24, 2025
    Copy the full SHA
    9153766 View commit details

Commits on Jan 27, 2025

  1. Copy the full SHA
    93a6f5f View commit details
  2. add info to ios shortcut

    poeti8 authored Jan 27, 2025
    Copy the full SHA
    c78eda2 View commit details

Commits on Jan 30, 2025

  1. Copy the full SHA
    630f96d View commit details

Commits on Feb 4, 2025

  1. Update README.md

    christianhuth authored Feb 4, 2025
    Copy the full SHA
    dd736f3 View commit details
  2. Update README.md

    christianhuth authored Feb 4, 2025
    Copy the full SHA
    9c22c14 View commit details

Commits on Feb 6, 2025

  1. Merge pull request #817 from christianhuth/patch-1

    Add Helm Chart
    poeti8 authored Feb 6, 2025
    Copy the full SHA
    83a5e97 View commit details
  2. Merge pull request #814 from trgwii/feature/docker-env-secrets-from-f…

    …iles
    
    Support reading env_FILE keys from file paths, closes #813
    poeti8 authored Feb 6, 2025
    Copy the full SHA
    86e4ba8 View commit details
  3. use double quotes

    poeti8 committed Feb 6, 2025
    Copy the full SHA
    4fd4d2e View commit details
  4. add env file description

    poeti8 authored Feb 6, 2025
    Copy the full SHA
    e75d4b2 View commit details
Showing with 37 additions and 24 deletions.
  1. +22 −22 README.md
  2. +15 −2 server/env.js
44 changes: 22 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -86,7 +86,9 @@ Official Kutt Docker image is available on [Docker Hub](https://hub.docker.com/r

The app is configured via environment variables. You can pass environment variables directly or create a `.env` file. View [`.example.env`](./.example.env) file for the list of configurations.

All variables are optional except `JWT_SECRET` which is required on production.
All variables are optional except `JWT_SECRET` which is required on production.

You can use files for each of the variables by appending `_FILE` to the name of the variable. Example: `JWT_SECRET_FILE=/path/to/secret_file`.

| Variable | Description | Default | Example |
| -------- | ----------- | ------- | ------- |
@@ -100,6 +102,7 @@ All variables are optional except `JWT_SECRET` which is required on production.
| `DISALLOW_ANONYMOUS_LINKS` | Disable anonymous link creation | `true` | `false` |
| `TRUST_PROXY` | If the app is running behind a proxy server like NGINX or Cloudflare and that it should get the IP address from that proxy server. If you're not using a proxy server then set this to false, otherwise users can override their IP address. | `true` | `false` |
| `DB_CLIENT` | Which database client to use. Supported clients: `pg` or `pg-native` for Postgres, `mysql2` for MySQL or MariaDB, `sqlite3` and `better-sqlite3` for SQLite. NOTE: `pg-native` and `sqlite3` are not installed by default, use `npm` to install them before use. | `better-sqlite3` | `pg` |
| `DB_FILENAME` | File path for the SQLite database. Only if you use SQLite. | `db/data` | `/var/lib/data` |
| `DB_HOST` | Database connection host. Only if you use Postgres or MySQL. | `localhost` | `your-db-host.com` |
| `DB_PORT` | Database port. Only if you use Postgres or MySQL. | `5432` (Postgres) | `3306` (MySQL) |
| `DB_NAME` | Database name. Only if you use Postgres or MySQL. | `kutt` | `mydb` |
@@ -211,31 +214,28 @@ Download Kutt's extension for web browsers via below links.

## Integrations

**ShareX**

You can use Kutt as your default URL shortener in [ShareX](https://getsharex.com/). If you host your custom instance of Kutt, refer to [ShareX wiki](https://github.com/thedevs-network/kutt/wiki/ShareX) on how to setup.

**Alfred workflow**

Download Kutt's official workflow for [Alfred](https://www.alfredapp.com/) app from [alfred-kutt](https://github.com/thedevs-network/alfred-kutt) repository.
- **ShareX** – You can use Kutt as your default URL shortener in [ShareX](https://getsharex.com/). If you host your custom instance of Kutt, refer to [ShareX wiki](https://github.com/thedevs-network/kutt/wiki/ShareX) on how to setup.
- **Alfred workflow** – Download Kutt's official workflow for [Alfred](https://www.alfredapp.com/) app from [alfred-kutt](https://github.com/thedevs-network/alfred-kutt) repository.
- **iOS shortcut**[Kutt shortcut](https://www.icloud.com/shortcuts/a829856aea2c420e97c53437e68b752b) for your apple device which works from the iOS sharing context menu or on standalone mode. A courtesy of [@caneeeeee](https://github.com/caneeeeee).

**Third-party packages**


| Language | Link | Description |
| ---------- | --------------------------------------------------------------------------------- | -------------------------------------------------- |
| C# (.NET) | [KuttSharp](https://github.com/0xaryan/KuttSharp) | .NET package for Kutt.it url shortener |
| C# (.NET) | [Kutt.NET](https://github.com/AlphaNecron/Kutt.NET) | C# API Wrapper for Kutt
| Python | [kutt-cli](https://github.com/RealAmirali/kutt-cli) | Command-line client for Kutt written in Python |
| Ruby | [kutt.rb](https://github.com/RealAmirali/kutt.rb) | Kutt library written in Ruby |
| Rust | [urlshortener](https://github.com/vityafx/urlshortener-rs) | URL shortener library written in Rust |
| Rust | [kutt-rs](https://github.com/robatipoor/kutt-rs) | Command line tool written in Rust |
| Node.js | [node-kutt](https://github.com/ardalanamini/node-kutt) | Node.js client for Kutt.it url shortener |
| JavaScript | [kutt-vscode](https://github.com/mehrad77/kutt-vscode) | Visual Studio Code extension for Kutt |
| Java | [kutt-desktop](https://github.com/cipher812/kutt-desktop) | A Cross platform Java desktop application for Kutt |
| Go | [kutt-go](https://github.com/raahii/kutt-go) | Go client for Kutt.it url shortener |
| BASH | [GitHub Gist](https://gist.github.com/hashworks/6d6e4eae8984a5018f7692a796d570b4) | Simple BASH function to access the API |
| BASH | [url-shortener](https://git.tim-peters.org/Tim/url-shortener) | Simple BASH script with GUI |
| Language | Link | Description |
| --------------- | --------------------------------------------------------------------------------- | ---------------------------------------------------- |
| C# (.NET) | [KuttSharp](https://github.com/0xaryan/KuttSharp) | .NET package for Kutt.it url shortener |
| C# (.NET) | [Kutt.NET](https://github.com/AlphaNecron/Kutt.NET) | C# API Wrapper for Kutt |
| Python | [kutt-cli](https://github.com/RealAmirali/kutt-cli) | Command-line client for Kutt written in Python |
| Ruby | [kutt.rb](https://github.com/RealAmirali/kutt.rb) | Kutt library written in Ruby |
| Rust | [urlshortener](https://github.com/vityafx/urlshortener-rs) | URL shortener library written in Rust |
| Rust | [kutt-rs](https://github.com/robatipoor/kutt-rs) | Command line tool written in Rust |
| Node.js | [node-kutt](https://github.com/ardalanamini/node-kutt) | Node.js client for Kutt.it url shortener |
| JavaScript | [kutt-vscode](https://github.com/mehrad77/kutt-vscode) | Visual Studio Code extension for Kutt |
| Java | [kutt-desktop](https://github.com/cipher812/kutt-desktop) | A Cross platform Java desktop application for Kutt |
| Go | [kutt-go](https://github.com/raahii/kutt-go) | Go client for Kutt.it url shortener |
| BASH | [GitHub Gist](https://gist.github.com/hashworks/6d6e4eae8984a5018f7692a796d570b4) | Simple BASH function to access the API |
| BASH | [url-shortener](https://git.tim-peters.org/Tim/url-shortener) | Simple BASH script with GUI |
| Kubernetes/Helm | [ArtifactHub](https://artifacthub.io/packages/helm/christianhuth/kutt) | A Helm Chart to install Kutt on a Kubernetes cluster |

## Contributing

17 changes: 15 additions & 2 deletions server/env.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require("dotenv").config();
const { cleanEnv, num, str, bool } = require("envalid");
const { readFileSync } = require("node:fs");

const supportedDBClients = [
"pg",
@@ -25,7 +26,7 @@ if (process.argv.includes("--production")) {
process.env.NODE_ENV = "production";
}

const env = cleanEnv(process.env, {
const spec = {
PORT: num({ default: 3000 }),
SITE_NAME: str({ example: "Kutt", default: "Kutt" }),
DEFAULT_DOMAIN: str({ example: "kutt.it", default: "localhost:3000" }),
@@ -64,6 +65,18 @@ const env = cleanEnv(process.env, {
REPORT_EMAIL: str({ default: "" }),
CONTACT_EMAIL: str({ default: "" }),
NODE_APP_INSTANCE: num({ default: 0 }),
});
};

for (const key in spec) {
const file_key = key + "_FILE";
if (!(file_key in process.env)) continue;
try {
process.env[key] = readFileSync(process.env[file_key], "utf8").trim();
} catch {
// on error, env_FILE just doesn't get applied.
}
}

const env = cleanEnv(process.env, spec);

module.exports = env;