my127 / workspace

Development environment tooling
MIT License
16 stars 13 forks source link

Display the sources of attribute in `config dump` #139

Closed g-foster2020 closed 1 year ago

g-foster2020 commented 1 year ago

Related to issue #108

For discussion.


Relevant yaml content and output examples:

__common.yml__
  pipeline:
    base:
      persistence: = @('persistence')

__workspace.yml__
  persistence:
    elasticsearch:
      enabled: false

> ws config dump --key=pipeline.base.persistence.elasticsearch.enabled     
Attribute with key pipeline.base.persistence.elasticsearch.enabled not found

> ws config dump --key=pipeline.base.persistence.elasticsearch               
Attribute with key pipeline.base.persistence.elasticsearch not found

> ws config dump --key=pipeline.base.persistence  
attribute value:

  enabled: false
  mountVolumesOnConsole: true
  elasticsearch:
    enabled: false
    accessMode: ReadWriteOnce
    size: 2Gi
  mongodb:
    enabled: true
    accessMode: ReadWriteOnce
    size: 1Gi
  mysql:
    enabled: true
    accessMode: ReadWriteOnce
    size: 4Gi
  rabbitmq:
    enabled: true
    accessMode: ReadWriteOnce
    size: 2Gi
  postgres:
    enabled: true
    accessMode: ReadWriteOnce
    size: 4Gi
  redis:
    enabled: false
    accessMode: ReadWriteOnce
    size: 2Gi
  redis-session:
    enabled: true
    accessMode: ReadWriteOnce
    size: 2Gi

specified in:

  - .my127ws/harness/attributes/common.yml

> ws config dump --key=persistence                                                
attribute value:

  enabled: false
  mountVolumesOnConsole: true
  elasticsearch:
    enabled: false
    accessMode: ReadWriteOnce
    size: 2Gi
  mongodb:
    enabled: true
    accessMode: ReadWriteOnce
    size: 1Gi
  mysql:
    enabled: true
    accessMode: ReadWriteOnce
    size: 4Gi
  rabbitmq:
    enabled: true
    accessMode: ReadWriteOnce
    size: 2Gi
  postgres:
    enabled: true
    accessMode: ReadWriteOnce
    size: 4Gi
  redis:
    enabled: false
    accessMode: ReadWriteOnce
    size: 2Gi
  redis-session:
    enabled: true
    accessMode: ReadWriteOnce
    size: 2Gi

specified in:

  - .my127ws/harness/attributes/common.yml
  - workspace.yml

__common.yml__
  pipeline:
    base:
      persistence: = @('persistence')
      hostname:  = @('pipeline.preview.hostname')

__workspace.yml__
  pipeline:
    base:
      hostname: override-it

> ws config dump --key=pipeline.base.hostname            
attribute value:

  override-it

specified in:

  - .my127ws/harness/attributes/common.yml
  - workspace.yml

__workspace.yml__
  tic: 
    tac:
      toe: 1

> ws config dump --key=tic                                                         
attribute value:

  tac:
    toe: 1

specified in:

  - workspace.yml

__common.yml__
  pipeline:
    base:
      persistence: = @('persistence')
      hostname:  = @('pipeline.preview.hostname')

__docker-base.yml__
  pipeline:
    base:
      prometheus:
        podMonitoring: false
      services:
        mysql:
          options: = @('services.mysql.options')
        relay:
          enabled: false

__workspace.yml__
  pipeline:
    base:
      hostname: override-it

> ws config dump --key=pipeline.base                                               
attribute value:

  persistence:
    enabled: false
    mountVolumesOnConsole: true
    elasticsearch:
      enabled: false
      accessMode: ReadWriteOnce
      size: 2Gi
    mongodb:
      enabled: true
      accessMode: ReadWriteOnce
      size: 1Gi
    mysql:
      enabled: true
      accessMode: ReadWriteOnce
      size: 4Gi
    rabbitmq:
      enabled: true
      accessMode: ReadWriteOnce
      size: 2Gi
    postgres:
      enabled: true
      accessMode: ReadWriteOnce
      size: 4Gi
    redis:
      enabled: false
      accessMode: ReadWriteOnce
      size: 2Gi
    redis-session:
      enabled: true
      accessMode: ReadWriteOnce
      size: 2Gi
  hostname: override-it
  prometheus:
    podMonitoring: false
  services:
    mysql:
      options:
        default_authentication_plugin: mysql_native_password
        ignore-db-dir: ''
        max_allowed_packet: 4M
    relay:
      enabled: false

specified in:

  - .my127ws/harness/attributes/common.yml
  - .my127ws/harness/attributes/docker-base.yml
  - workspace.yml
g-foster2020 commented 1 year ago

I've added an optional --simple flag.

❯ bin/workspace config dump --key=tic.tac --simple                                            
array(1) {
  ["toe"]=>
  int(1)
}
❯ bin/workspace config dump --key=tic.tac.toe --simple                                      
1