Skip to content

Commit e97e160

Browse files
committed
fix: dir templates
1 parent b499fd6 commit e97e160

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

pkg/actions/app_add.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,12 @@ func (d *AppAdd) promptBasic() error {
289289
return errAppAddCanceled
290290
}
291291

292+
// Cleanup.
293+
if filepath.IsAbs(d.opts.Dir) {
294+
d.opts.Dir, _ = filepath.Rel(d.cfg.Dir, d.opts.Dir)
295+
d.opts.Dir = "./" + d.opts.Dir
296+
}
297+
292298
return err
293299
}
294300

@@ -453,13 +459,16 @@ func (d *AppAdd) promptStatic() (*staticAppInfo, error) {
453459
}
454460

455461
// Cleanup.
456-
d.opts.StaticBuildDir, _ = filepath.Rel(d.opts.Dir, d.opts.StaticBuildDir)
457-
d.opts.StaticBuildDir = "./" + d.opts.StaticBuildDir
462+
if filepath.IsAbs(d.opts.StaticBuildDir) {
463+
d.opts.StaticBuildDir, _ = filepath.Rel(filepath.Join(d.cfg.Dir, d.opts.Dir), d.opts.StaticBuildDir)
464+
d.opts.StaticBuildDir = "./" + d.opts.StaticBuildDir
465+
}
458466

459467
return &staticAppInfo{
460468
App: config.StaticApp{
461469
BasicApp: config.BasicApp{
462470
AppName: d.opts.Name,
471+
AppType: config.AppTypeStatic,
463472
AppURL: d.opts.URL,
464473
AppDir: d.opts.Dir,
465474
AppRun: &config.AppRun{
@@ -503,6 +512,7 @@ func (d *AppAdd) promptService() (*serviceAppInfo, error) {
503512
App: config.ServiceApp{
504513
BasicApp: config.BasicApp{
505514
AppName: d.opts.Name,
515+
AppType: config.AppTypeService,
506516
AppURL: d.opts.URL,
507517
AppDir: d.opts.Dir,
508518
AppRun: &config.AppRun{

templates/app-service.yaml.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dir: {{.App.Dir}}
1313
type: {{.App.Type}}
1414

1515
# URL of the app.
16-
url: {{.App.URL}}
16+
url: {{.App.AppURL}}
1717
# Path redirect rewrites URL to specified path. URL path from 'url' field will be stripped and replaced with value below.
1818
# '/' should be fine for most apps.
1919
pathRedirect: /
@@ -23,7 +23,7 @@ build:
2323
# Dockerfile name to be used.
2424
dockerfile: {{.App.Build.Dockerfile}}
2525
# Directory which is used for dockerfile context.
26-
context: {{.App.Build.Context}}
26+
context: {{.App.Build.DockerContext}}
2727

2828
# Run defines where how development is handled of application during `ok run`.
2929
run:

templates/app-static.yaml.tpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ dir: {{.App.Dir}}
1313
type: {{.App.Type}}
1414

1515
# URL of the app.
16-
url: {{.App.URL}}
16+
url: {{.App.AppURL}}
1717
# Path redirect rewrites URL to specified path. URL path from 'url' field will be stripped and replaced with value below.
1818
# '/' should be fine for most apps.
1919
pathRedirect: /

0 commit comments

Comments
 (0)