0.24.0-alpha.0 • Published 13 days ago

@toa.io/extensions.configuration v0.24.0-alpha.0

Weekly downloads
-
License
-
Repository
github
Last release
13 days ago

Toa Configuration Extension

TL;DR

Define

# component.toa.yaml
name: dummy
namespace: dummies

configuration:
  foo: bar
  baz: 1

Use

function transition (input, entity, context) {
  const { foo, baz } = context.configuration

  // ...
}

Override

# context.toa.yaml
configuration:
  dummies.dummy:
    foo: qux
    foo@staging: quux # use deployment environment discriminator
    baz: $BAZ_VALUE   # use secrets

Deploy secrets

$ toa conceal

Problem Definition

  • Components must be reusable in different contexts and deployment environments, that is in different configurations.
  • Some algorithm parameters must be deployed secretly.

Definitions

Configuration (Distributed System Configuration)

Set of static^1 parameters for all algorithms within a given system.

Configuration Schema

Schema defining component's algorithms parameters (optionally with default values).

Configuration Object

Value valid against Configuration Schema.

Configuration Value

Merge result of Configuration Schema's defaults and Configuration Object.

Context Configuration

Map of Configuration Objects for components added to a given context.

Responsibility Segregation

Configuration Schema is a form of configuration defined by component. Specific values for specific contexts and deployment environments are defined by Context Configuration according to the Schema.

See Reusable Components.

Configuration Schema

Configuration Schema is declared as a component extension using JSON Schema object type.

Warning By introducing non-backward compatible changes to a Configuration Schema the compatibility with existent contexts and deployment environments will be broken. That is, Configuration Schema changes are subjects of component versioning.

Recommendation Having default values for all required parameters will allow components to be runnable without configuration (i.e. on local environment).

Example

# component.toa.yaml
name: dummy
namespace: dummies

extensions:
  @toa.io/extensions.configuration:
     properties:
       foo:
         type: string
         default: 'baz'
       bar:
         type: number
     required: [foo]

Concise Declaration

As it is known that Configuration Schema is declared with a JSON Schema object type, any configuration declaration without defined properties considered as concise. Properties of concise declaration are treated as required Configuration Schema properties with the same type as its value type and no additional properties allowed.

Also note that a well-known shortcut configuration is available.

Next two declarations are equivalent.

# component.toa.yaml
configuration:
  foo: baz
  bar: 1
# component.toa.yaml
extensions:
  @toa.io/extensions.configuration:
     properties:
       foo:
         type: string
         default: baz
       bar:
         type: number
         default: 1
     additionalProperties: false
     required: [foo, bar]

Context Configuration

Context Configuration is declared as a context annotaion. Its keys must be component identifiers and its values must be Configuration Objects for those components.

Context Configuration keys and Configuration Object keys may be defined with deployment environment discriminators.

Example

# context.toa.yaml
configuration:
  dummies.dummy:
    foo: quu
    bar: 1
    bar@staging: 2

Local environment

Configuration Objects for local environment may be created by toa configure command.

Configuration Secrets

Context Configuration values which are uppercase strings prefixed with $ considered as Secrets.

Example

# context.toa.yaml
configuration:
  payments.gateway:
    api-key: $STRIPE_API_KEY

Secrets Deployment

Secrets are not being deployed with context deployment (toa deploy), thus must be deployed separately at least once for each deployment environment manually (toa conceal).

Operation Context

Configuration Value is available as a well-known operation context extension configuration.

Usage: node

function transition (input, entity, context) {
  const foo = context.configiuration.foo

  // ...
}

Warning It is strongly not recommended to store a copy of value type configuration values outside of operation scope, thus it prevents operation to benefit from hot updates.

// THIS IS WEIRD, BAD AND NOT RECOMMENDED
let foo

function transition (input, entity, context) {
  if (foo === undefined) foo = context.configuration.foo

  // ...
}

See Genuine operations.

Appendix

^1: Cannot be changed without a deployment. New values are considered to be a subject of testing. #146

1.0.0-alpha.34

13 days ago

1.0.0-alpha.33

13 days ago

1.0.0-alpha.36

13 days ago

1.0.0-alpha.35

13 days ago

1.0.0-alpha.32

15 days ago

1.0.0-alpha.30

18 days ago

1.0.0-alpha.31

17 days ago

1.0.0-alpha.29

18 days ago

1.0.0-alpha.27

23 days ago

1.0.0-alpha.28

23 days ago

1.0.0-alpha.26

1 month ago

1.0.0-alpha.25

1 month ago

1.0.0-alpha.24

2 months ago

1.0.0-alpha.23

2 months ago

1.0.0-alpha.22

2 months ago

1.0.0-alpha.21

2 months ago

1.0.0-alpha.20

2 months ago

1.0.0-alpha.19

2 months ago

1.0.0-alpha.18

2 months ago

1.0.0-alpha.17

2 months ago

1.0.0-alpha.16

2 months ago

1.0.0-alpha.15

2 months ago

1.0.0-alpha.14

2 months ago

1.0.0-alpha.13

2 months ago

1.0.0-alpha.12

3 months ago

1.0.0-alpha.10

3 months ago

1.0.0-alpha.11

3 months ago

1.0.0-alpha.9

3 months ago

1.0.0-alpha.8

3 months ago

1.0.0-alpha.7

3 months ago

1.0.0-alpha.6

3 months ago

1.0.0-alpha.5

3 months ago

1.0.0-alpha.4

3 months ago

1.0.0-alpha.3

3 months ago

1.0.0-alpha.2

3 months ago

0.24.0-alpha.23

3 months ago

0.24.0-alpha.22

3 months ago

0.24.0-alpha.21

3 months ago

0.24.0-alpha.20

3 months ago

0.24.0-alpha.19

3 months ago

0.24.0-alpha.16

5 months ago

0.24.0-alpha.17

5 months ago

0.24.0-alpha.18

5 months ago

0.24.0-alpha.15

6 months ago

0.24.0-alpha.13

6 months ago

0.24.0-alpha.14

6 months ago

0.23.0-dev.0

7 months ago

0.20.0

7 months ago

1.0.0-alpha.0

6 months ago

0.20.0-dev.29

11 months ago

0.24.0-alpha.4

6 months ago

0.24.0-alpha.3

6 months ago

0.24.0-alpha.10

6 months ago

0.24.0-alpha.6

6 months ago

0.24.0-alpha.11

6 months ago

0.24.0-alpha.5

6 months ago

0.24.0-alpha.12

6 months ago

0.24.0-alpha.8

6 months ago

0.24.0-alpha.7

6 months ago

0.24.0-alpha.9

6 months ago

0.24.0-alpha.0

6 months ago

0.24.0-alpha.2

6 months ago

0.22.1

7 months ago

0.22.0

7 months ago

0.20.0-dev.40

9 months ago

0.20.0-alpha.0

8 months ago

0.20.0-alpha.1

8 months ago

0.20.0-alpha.2

7 months ago

0.20.0-dev.36

9 months ago

0.20.0-dev.35

9 months ago

0.20.0-dev.34

9 months ago

0.20.0-dev.39

9 months ago

0.20.0-dev.38

9 months ago

0.20.0-dev.37

9 months ago

0.20.0-dev.31

11 months ago

0.20.0-dev.30

11 months ago

0.20.1-alpha.0

7 months ago

0.20.0-dev.28

11 months ago

0.20.0-dev.24

11 months ago

0.20.0-dev.23

11 months ago

0.20.0-dev.22

11 months ago

0.20.0-dev.21

11 months ago

0.20.0-dev.20

11 months ago

0.20.0-dev.19

11 months ago

0.20.0-dev.14

12 months ago

0.20.0-dev.18

11 months ago

0.20.0-dev.17

11 months ago

0.20.0-dev.16

11 months ago

0.20.0-dev.15

12 months ago

1.0.1

1 year ago

1.0.0

1 year ago

1.0.0-dev.1

1 year ago

1.1.0-dev.12

12 months ago

1.1.0-dev.11

12 months ago

1.1.0-dev.13

12 months ago

1.1.0-dev.16

12 months ago

1.1.0-dev.15

12 months ago

1.1.0-dev.10

12 months ago

0.20.0-dev.7

12 months ago

0.20.0-dev.6

12 months ago

0.20.0-dev.5

12 months ago

0.20.0-dev.4

12 months ago

0.20.0-dev.3

12 months ago

0.20.0-dev.2

12 months ago

1.0.2-alpha.56

12 months ago

0.20.0-dev.1

12 months ago

1.1.0-dev.2

1 year ago

1.1.0-dev.3

1 year ago

1.1.0-dev.0

1 year ago

1.1.0-dev.1

1 year ago

1.1.0-dev.6

1 year ago

1.1.0-dev.7

1 year ago

1.1.0-dev.4

1 year ago

1.1.0-dev.5

1 year ago

1.1.0-canary.0

12 months ago

1.1.0-canary.2

12 months ago

1.1.0-dev.8

1 year ago

1.1.0-canary.1

12 months ago

1.1.0-dev.9

12 months ago

0.20.0-dev.9

12 months ago

0.20.0-dev.8

12 months ago

0.20.0-dev.13

12 months ago

0.20.0-dev.12

12 months ago

0.20.0-dev.11

12 months ago

1.0.0-dev.0

1 year ago

0.20.0-dev.10

12 months ago

1.0.1-dev.0

1 year ago

0.7.2-dev.6

1 year ago

0.7.2-dev.5

1 year ago

0.7.2-dev.4

1 year ago

0.7.2-dev.3

1 year ago

0.7.2-dev.2

1 year ago

0.7.2-dev.1

1 year ago

0.7.2-dev.0

1 year ago

0.7.0-dev.0

1 year ago

0.7.0-dev.1

1 year ago

0.7.0-dev.2

1 year ago

0.7.3-dev.1

1 year ago

0.7.3-dev.0

1 year ago

0.7.3-dev.2

1 year ago

0.6.0-dev.4

1 year ago

0.7.1-dev.0

1 year ago

0.7.2

1 year ago

0.7.1

1 year ago

0.7.3

1 year ago

0.7.1-dev.2

1 year ago

0.7.0

1 year ago

0.6.0

1 year ago

0.6.0-dev.3

1 year ago

0.6.0-dev.1

1 year ago

0.4.0

1 year ago

0.4.0-dev.9

1 year ago

0.4.0-dev.8

1 year ago

0.4.0-dev.6

1 year ago

0.4.0-dev.2

1 year ago

0.4.0-dev.0

1 year ago

0.3.0

1 year ago

0.2.1-dev.4

1 year ago

0.2.1-dev.3

1 year ago