Listen on 0.0.0.0 by default and log LAN addresses
- New CANON_HOST (default 0.0.0.0; 127.0.0.1 keeps it on one machine) - On start, log the http:// addresses other devices can use, skipping Docker/VM bridge interfaces - docker-compose publishes 0.0.0.0:4242 explicitly - README: opening Canon from other devices and firewall note Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7320e3f707
commit
bcc5e69094
5 files changed
+66
-2
No files matched your search
@@ -2,6 +2,7 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"net"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -12,6 +13,8 @@ import (
|
||||
// fields here only act as overrides when set.
|
||||
type Config struct {
|
||||
ListenAddr string
|
||||
Host string
|
||||
Port string
|
||||
DataDir string
|
||||
AdminUsername string
|
||||
AdminPassword string
|
||||
@@ -28,9 +31,14 @@ type Config struct {
|
||||
}
|
||||
|
||||
func Load() Config {
|
||||
// 0.0.0.0 accepts connections from other devices on the network, not
|
||||
// just this machine. Use 127.0.0.1 to keep it local.
|
||||
host := env("CANON_HOST", "0.0.0.0")
|
||||
port := env("CANON_PORT", "4242")
|
||||
return Config{
|
||||
ListenAddr: env("CANON_LISTEN", ":"+port),
|
||||
ListenAddr: env("CANON_LISTEN", net.JoinHostPort(host, port)),
|
||||
Host: host,
|
||||
Port: port,
|
||||
DataDir: env("CANON_DATA_DIR", "./data"),
|
||||
AdminUsername: env("CANON_ADMIN_USERNAME", ""),
|
||||
AdminPassword: env("CANON_ADMIN_PASSWORD", ""),
|
||||
|
||||
Reference in new issue
Block a user