summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorKyren223 <Kyren223@proton.me>2025-01-08 23:20:38 +0200
committerKyren223 <Kyren223@proton.me>2025-01-08 23:20:38 +0200
commit576adb547cac5a3484aa1c53881e69bf0f729afd (patch)
treee446da8d683774ef7263338d5b4ef2b5d172c898 /internal
parentdbea21d9c3642fce6b25837c2ec5fd704a7e8f2a (diff)
Implemented CD
Diffstat (limited to 'internal')
-rw-r--r--internal/client/config/config.go16
-rw-r--r--internal/client/gateway/gateway.go11
-rw-r--r--internal/server/server.go5
3 files changed, 21 insertions, 11 deletions
diff --git a/internal/client/config/config.go b/internal/client/config/config.go
index daa3d58..0d81405 100644
--- a/internal/client/config/config.go
+++ b/internal/client/config/config.go
@@ -10,16 +10,20 @@ import (
)
type Config struct {
- PrivateKeyPath string `json:"private_key_path"`
- InsertModeTabToSpace bool `json:"insert_mode_tab_to_space"`
- InsertModeSpacesPerTab uint8 `json:"insert_mode_spaces_per_tab"`
+ ServerName string `json:"server_name"`
+ PrivateKeyPath string `json:"private_key_path"`
+ InsertModeTabToSpace bool `json:"insert_mode_tab_to_space"`
+ InsertModeSpacesPerTab uint8 `json:"insert_mode_spaces_per_tab"`
+ InsecureSkipServerVerification bool `json:"insecure_skip_server_verification"`
}
func Default() Config {
return Config{
- PrivateKeyPath: "",
- InsertModeTabToSpace: true,
- InsertModeSpacesPerTab: 4,
+ ServerName: "eko.kyren.codes",
+ PrivateKeyPath: "",
+ InsertModeTabToSpace: true,
+ InsertModeSpacesPerTab: 4,
+ InsecureSkipServerVerification: false,
}
}
diff --git a/internal/client/gateway/gateway.go b/internal/client/gateway/gateway.go
index 11d15bb..38140e8 100644
--- a/internal/client/gateway/gateway.go
+++ b/internal/client/gateway/gateway.go
@@ -15,6 +15,7 @@ import (
tea "github.com/charmbracelet/bubbletea"
"github.com/kyren223/eko/certs"
+ "github.com/kyren223/eko/internal/client/config"
"github.com/kyren223/eko/internal/client/ui"
"github.com/kyren223/eko/internal/packet"
"github.com/kyren223/eko/pkg/assert"
@@ -44,9 +45,10 @@ func init() {
}
tlsConfig = &tls.Config{
- RootCAs: certPool,
- ServerName: "localhost",
- MinVersion: tls.VersionTLS12,
+ RootCAs: certPool,
+ ServerName: config.Read().ServerName,
+ MinVersion: tls.VersionTLS12,
+ InsecureSkipVerify: config.Read().InsecureSkipServerVerification,
}
}
@@ -71,7 +73,8 @@ func connect(ctx context.Context, privKey ed25519.PrivateKey) (snowflake.ID, err
errChan := make(chan error, 1)
go func() {
framer = packet.NewFramer()
- connection, err := tls.Dial("tcp4", ":7223", tlsConfig)
+ address := config.Read().ServerName
+ connection, err := tls.Dial("tcp4", address + ":7223", tlsConfig)
if err != nil {
errChan <- err
return
diff --git a/internal/server/server.go b/internal/server/server.go
index 2e5cd7b..e2b2a40 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -30,7 +30,10 @@ var (
)
func init() {
- path := "certs/server.key"
+ path, ok := os.LookupEnv("SERVER_CERT_KEY_FILE")
+ if !ok {
+ path = "certs/server.key"
+ }
keyPEM, err := os.ReadFile(path)
if err != nil {
log.Fatalln("failed to read certificate key from", path)