Cameron Diver
ea64f0b0b3
Upgrade typescript and fix warnings
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-06-10 15:35:43 +01:00
Cameron Diver
2a27b1d51f
Move to resin-lint 3 and fix lint errors
...
This is a massive commit, but nothing related to runtime has actually
changed, only the lint errors have changed.
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-05-26 18:54:09 +01:00
Cameron Diver
c211efe399
device-config: Use default values for any invalid target values
...
If a value is requested which does not pass validation, we instead set
it to the default value, to ensure that the state engine continues to
work and move towards the target state.
Change-type: minor
Closes : #938
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-03-27 13:08:04 +00:00
Cameron Diver
987de0e097
debug: Print more information about failing validations
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-25 13:22:09 +01:00
Cameron Diver
3d6dc88eb0
Make sure to correctly convert config emit events after validation
...
We were validating the input configuration values by coercing them to
the correct type, and then using the initial value to be saved (which
currently is always converted to a string).
We now use the coerced value as the actual value we will store, and more
importantly emit. This means that the config.on('change' ...) calls will
always be properly typed, which before this change was not a guarantee
that we could make.
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-02-11 11:22:08 +00:00
Cameron Diver
6f9d9e5de6
Prefer optional type in ConfigChangeMap
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-01-23 16:31:33 +00:00
Cameron Diver
0505c0f976
config: Properly type the change events from config module
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-01-21 11:13:14 +00:00
Cameron Diver
9a98fc4c84
refactor: Small code changes
...
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-01-11 10:38:05 +00:00
Cameron Diver
db74e748a1
refactor: Fully type and validate config module set and get
...
We define the type for each config value, and validate the data when
retrieving and setting it.
Change-type: minor
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-01-11 10:37:25 +00:00
Cameron Diver
ac4866170e
refactor: Remove scaffolding for unused mutable config functions
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-01-11 10:37:24 +00:00
Cameron Diver
9decea1d3b
refactor: Convert supervisor api module to typescript
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-01-08 11:59:53 +00:00
Cameron Diver
3a130f4f9c
refactor: Change config modules export type to new-style
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2019-01-02 18:12:22 +00:00
Cameron Diver
de5157c04c
refactor: Change export style of db to named
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2018-12-21 17:18:33 +00:00
Cameron Diver
151af309fb
config: Force config values to strings when storing in db
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2018-12-17 10:53:23 +00:00
Cameron Diver
82602abf8d
config: Replace supervisorOfflineMode and offlineMode with unmanaged
...
Change-type: major
Signed-off-by: Cameron Diver <cameron@balena.io>
2018-12-14 15:01:41 +00:00
Cameron Diver
5bb3820d6a
Switch to local mode in unmanaged mode
...
Change-type: major
Signed-off-by: Cameron Diver <cameron@balena.io>
2018-12-14 15:01:41 +00:00
Cameron Diver
91a6340563
Move config.json flag back to the database
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2018-12-14 15:01:40 +00:00
Cameron Diver
64a8c03eba
unmanged: Don't require a device name when setting a target state
...
Also set a default device name of 'local', to avoid an undefined value.
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2018-11-29 11:35:08 +00:00
Cameron Diver
b37ce5e3d9
config: Set default apiKey of empty string to avoid undefined keys
...
Change-type: patch
Signed-off-by: Cameron Diver <cameron@balena.io>
2018-11-28 14:53:09 +00:00
Cameron Diver
142d2a7c6f
config: Move config.ts -> config/index.ts
...
Signed-off-by: Cameron Diver <cameron@balena.io>
2018-11-28 14:53:08 +00:00