Skip to content

Commit

Permalink
adds global parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Doug Hatcher committed Jun 19, 2022
1 parent 8a52c24 commit 171f7a9
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 16 deletions.
9 changes: 9 additions & 0 deletions docs/content/en/docs/Getting started/usage.md
@@ -0,0 +1,9 @@
---
title: Usage
description: Basic usage conventions and information
---

# .magento-cli directories

A project repostiory can override the default configuration by storing replacement services or tasks yaml directories in `.magento-cli`. For example, let's say you would like to change the database docker composition, you canc create `.magento-cli/services/database.yaml` and this file will be interpreted when you run `magento serve` instead of the version sourced by magento-cli.

3 changes: 2 additions & 1 deletion main.go
Expand Up @@ -34,12 +34,13 @@ var yamlExt string = ".yaml"
var configDir string = ".magento-cli"

func main() {

// put services files in a temp directory
extractYamlToTemp(services)

// feeds configuration into paraser and executes
cmd.YAML(string(loadYaml(tasks)))

// clean teh temp diretory
rmTemp()
}

Expand Down
15 changes: 15 additions & 0 deletions tasks/parameters.yaml
@@ -0,0 +1,15 @@
#!/usr/bin/env variant
definitions:
parameters: &global-parameters
- name: host
type: string
description: hostname to serve
default: 0.0.0.0
- name: port
type: string
description: php server port
default: "8080"
- name: routes
type: string
description: routes used for local development server
default: $(pwd)/pub/ $(pwd)/phpserver/router.php
2 changes: 1 addition & 1 deletion tasks/passthru.yaml
@@ -1,4 +1,4 @@
#!/usr/bin/env variant
script: |
CMD=$(echo {{ index .args }} | sed -r 's/(\[|\])//g')
$MAGECLI_PHP_CMD bin/magento $CMD
$MAGECLI_PHP_CMD bin/magento $CMD
16 changes: 2 additions & 14 deletions tasks/serve.yaml
@@ -1,18 +1,6 @@
#!/usr/bin/env variant
tasks:
serve:
parameters:
- name: host
type: string
description: hostname to serve
default: 0.0.0.0
- name: port
type: string
description: php server port
default: "8080"
- name: routes
tyoe: string
description: routes used for local development server
default: $(pwd)/pub/ $(pwd)/phpserver/router.php
parameters: *global-parameters
script: |
php -S {{ get "host" }}:{{ get "port" }} -t {{ get "routes" }}
echo {{ index .args }} php -S {{ get "host" }}:{{ get "port" }} -t {{ get "routes" }}

0 comments on commit 171f7a9

Please sign in to comment.