Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ jobs:
file katana-linux-x64
file katana-linux-arm64

- name: Package modules directory
run: zip -r modules.zip modules

- name: Extract version from tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -71,6 +74,7 @@ jobs:
files: |
katana-linux-x64
katana-linux-arm64
modules.zip
draft: false
prerelease: false
env:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"dev": "bun run src/cli.ts",
"build:ui": "bun run src/ui/build.ts",
"build": "bun run build:ui && bun build --compile src/cli.ts --outfile bin/katana",
"build": "bun run build:ui && KATANA_COMPILED=true bun build --compile src/cli.ts --outfile bin/katana",
"test": "bun test",
"lint": "bunx biome check src/",
"format": "bunx biome format --write src/"
Expand Down
55 changes: 38 additions & 17 deletions src/types/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { isCompiled } from "@/utils/isCompiled" with { type: "macro" };
import { z } from "zod";

/**
Expand Down Expand Up @@ -47,23 +48,43 @@ export type Config = z.infer<typeof ConfigSchema>;
/**
* Default configuration values
*/
export const DEFAULT_CONFIG: Config = {
install_type: "local",
local_domain: "samurai.wtf",
dashboard_hostname: "katana",
paths: {
modules: "/opt/samurai/katana/modules",
data: "~/.local/share/katana",
certs: "~/.local/share/katana/certs",
state: "~/.local/share/katana/state.yml",
},
proxy: {
http_port: 80,
https_port: 443,
bind_address: undefined,
},
docker_network: "katana-net",
};
export const DEFAULT_CONFIG: Config = ((compiled) => {
return compiled
? {
install_type: "local",
local_domain: "samurai.wtf",
dashboard_hostname: "katana",
paths: {
modules: "/opt/katana/modules",
data: "~/.local/share/katana",
certs: "~/.local/share/katana/certs",
state: "~/.local/share/katana/state.yml",
},
proxy: {
http_port: 80,
https_port: 443,
bind_address: undefined,
},
docker_network: "katana-net",
}
: {
install_type: "local",
local_domain: "samurai.wtf",
dashboard_hostname: "katana",
paths: {
modules: "./modules",
data: "~/.local/share/katana",
certs: "~/.local/share/katana/certs",
state: "~/.local/share/katana/state.yml",
},
proxy: {
http_port: 80,
https_port: 443,
bind_address: undefined,
},
docker_network: "katana-net",
};
})(isCompiled());

/**
* Validate and parse config data
Expand Down
6 changes: 6 additions & 0 deletions src/utils/isCompiled.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Macro as a janky workaround because Bun's documentation claims Bun.isStandaloneExecutable should tell this
// But it doesn't. Type definitions don't even show that property on the Bun object, and it's always undefined
// regardless of whether we build or run locally.
export function isCompiled() {
return Boolean(Bun.env.KATANA_COMPILED);
}
Loading