feat: add ax serve command with JSON API backed by NodeService
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -11,8 +11,9 @@ import (
|
||||
|
||||
type fileConfig struct {
|
||||
path string
|
||||
User string `json:"user"`
|
||||
UserAliases []*Alias `json:"aliases"`
|
||||
User string `json:"user"`
|
||||
UserAliases []*Alias `json:"aliases"`
|
||||
Serve ServerConfig `json:"serve"`
|
||||
}
|
||||
|
||||
var defaultAliases = []*Alias{
|
||||
@@ -140,6 +141,18 @@ func (c *fileConfig) ListAliases() ([]*Alias, error) {
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func (c *fileConfig) GetServerConfig() ServerConfig {
|
||||
host := c.Serve.Host
|
||||
if host == "" {
|
||||
host = "localhost"
|
||||
}
|
||||
port := c.Serve.Port
|
||||
if port == 0 {
|
||||
port = 7000
|
||||
}
|
||||
return ServerConfig{Host: host, Port: port}
|
||||
}
|
||||
|
||||
func (c *fileConfig) Save() error {
|
||||
if err := os.MkdirAll(filepath.Dir(c.path), 0755); err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user