diff --git a/README.md b/README.md index ec9e6123..06f077dc 100644 --- a/README.md +++ b/README.md @@ -105,12 +105,9 @@ The `config.json` file should look something like this: { "applicationId": "2167", /* Id of the app this supervisor will run */ "apiKey": "supersecretapikey", /* The API key to provision the device on the balena API */ - "userId": "141", /* User ID for the user who owns the app */ - "username": "gh_pcarranzav", /* User name for the user who owns the app */ "deviceType": "intel-nuc", /* The device type corresponding to the test application */ "apiEndpoint": "https://api.balena-cloud.com", /* Endpoint for the balena API */ "deltaEndpoint": "https://delta.balena-cloud.com", /* Endpoint for the delta server to download Docker binary diffs */ - "vpnEndpoint": "vpn.balena-cloud.com", /* Endpoint for the balena VPN server */ "listenPort": 48484, /* Listen port for the supervisor API */ "mixpanelToken": "aaaaaaaaaaaaaaaaaaaaaaaaaa", /* Mixpanel token to report events */ } diff --git a/src/api-binder.ts b/src/api-binder.ts index 8d56a134..3d0ecfe6 100644 --- a/src/api-binder.ts +++ b/src/api-binder.ts @@ -289,7 +289,6 @@ export class APIBinder { 'unmanaged', 'provisioned', 'apiTimeout', - 'userId', 'deviceId', ]); @@ -307,9 +306,7 @@ export class APIBinder { ); } - // TODO: When API supports it as per https://github.com/resin-io/hq/pull/949 remove userId _.defaults(device, { - belongs_to__user: conf.userId, is_managed_by__device: conf.deviceId, uuid: deviceRegister.generateUniqueKey(), registered_at: Math.floor(Date.now() / 1000), diff --git a/src/config/functions.ts b/src/config/functions.ts index 67bc077d..0d4c643a 100644 --- a/src/config/functions.ts +++ b/src/config/functions.ts @@ -54,7 +54,6 @@ export const fnSchema = { return config .getMany([ 'uuid', - 'userId', 'applicationId', 'apiKey', 'deviceApiKey', @@ -69,7 +68,6 @@ export const fnSchema = { return { uuid: conf.uuid, applicationId: conf.applicationId, - userId: conf.userId, deviceArch: conf.deviceArch, deviceType: conf.deviceType, provisioningApiKey: conf.apiKey, diff --git a/src/config/schema-type.ts b/src/config/schema-type.ts index 0371af0f..5ba30acc 100644 --- a/src/config/schema-type.ts +++ b/src/config/schema-type.ts @@ -46,14 +46,6 @@ export const schemaTypes = { type: t.string, default: 'unknown', }, - username: { - type: t.string, - default: NullOrUndefined, - }, - userId: { - type: PermissiveNumber, - default: NullOrUndefined, - }, deviceId: { type: PermissiveNumber, default: NullOrUndefined, @@ -204,7 +196,6 @@ export const schemaTypes = { // from the definitions above and still have the types work uuid: t.union([t.string, NullOrUndefined]), applicationId: t.union([PermissiveNumber, NullOrUndefined]), - userId: t.union([PermissiveNumber, NullOrUndefined]), deviceType: t.string, provisioningApiKey: t.union([t.string, NullOrUndefined]), deviceApiKey: t.string, diff --git a/src/config/schema.ts b/src/config/schema.ts index bf0ec2be..5348c3b0 100644 --- a/src/config/schema.ts +++ b/src/config/schema.ts @@ -39,16 +39,6 @@ export const schema = { mutable: false, removeIfNull: false, }, - username: { - source: 'config.json', - mutable: false, - removeIfNull: false, - }, - userId: { - source: 'config.json', - mutable: false, - removeIfNull: false, - }, deviceId: { source: 'config.json', mutable: true, diff --git a/test/03-config.spec.ts b/test/03-config.spec.ts index b5a515ae..4ba1a5a5 100644 --- a/test/03-config.spec.ts +++ b/test/03-config.spec.ts @@ -63,7 +63,7 @@ describe('Config', () => { }); it('does not allow setting an immutable field', async () => { - const promise = conf.set({ username: 'somebody else' }); + const promise = conf.set({ deviceType: 'a different device type' }); // We catch it to avoid the unhandled error log promise.catch(_.noop); return expect(promise).to.be.rejected; diff --git a/test/11-api-binder.spec.ts b/test/11-api-binder.spec.ts index 83269c58..9d1bd68b 100644 --- a/test/11-api-binder.spec.ts +++ b/test/11-api-binder.spec.ts @@ -110,7 +110,6 @@ describe('ApiBinder', () => { expect(balenaAPI.balenaBackend!.devices).to.deep.equal({ '1': { id: 1, - user: conf.userId, application: conf.applicationId, uuid: conf.uuid, device_type: conf.deviceType, diff --git a/test/data/testconfig-apibinder-offline.json b/test/data/testconfig-apibinder-offline.json index 1ca56f75..6dbe83ea 100644 --- a/test/data/testconfig-apibinder-offline.json +++ b/test/data/testconfig-apibinder-offline.json @@ -1,13 +1,9 @@ { - "applicationName": "supertestrpi3", "applicationId": 78373, "deviceType": "raspberrypi3", - "userId": 1001, - "username": "someone", "appUpdatePollInterval": 3000, "listenPort": 2345, "vpnPort": 443, - "vpnEndpoint": "vpn.resin.io", "registryEndpoint": "registry2.resin.io", "deltaEndpoint": "https://delta.resin.io", "mixpanelToken": "baz", diff --git a/test/data/testconfig-apibinder.json b/test/data/testconfig-apibinder.json index a7238aa9..f22685af 100644 --- a/test/data/testconfig-apibinder.json +++ b/test/data/testconfig-apibinder.json @@ -1 +1 @@ -{"applicationName":"supertestrpi3","applicationId":78373,"deviceType":"raspberrypi3","userId":1001,"username":"someone","appUpdatePollInterval":3000,"listenPort":2345,"vpnPort":443,"apiEndpoint":"http://0.0.0.0:3000","vpnEndpoint":"vpn.resin.io","registryEndpoint":"registry2.resin.io","deltaEndpoint":"https://delta.resin.io","mixpanelToken":"baz","apiKey":"boo","version":"2.0.6+rev3.prod"} +{"applicationId":78373,"deviceType":"raspberrypi3","appUpdatePollInterval":3000,"listenPort":2345,"vpnPort":443,"apiEndpoint":"http://0.0.0.0:3000","registryEndpoint":"registry2.resin.io","deltaEndpoint":"https://delta.resin.io","mixpanelToken":"baz","apiKey":"boo","version":"2.0.6+rev3.prod"} diff --git a/test/data/testconfig.json b/test/data/testconfig.json index 4c2c7800..b7b8bd43 100644 --- a/test/data/testconfig.json +++ b/test/data/testconfig.json @@ -1 +1 @@ -{"applicationName":"supertestrpi3","applicationId":78373,"deviceType":"raspberrypi3","userId":1001,"username":"someone","appUpdatePollInterval":3000,"listenPort":2345,"vpnPort":443,"apiEndpoint":"https://api.resin.io","vpnEndpoint":"vpn.resin.io","registryEndpoint":"registry2.resin.io","deltaEndpoint":"https://delta.resin.io","mixpanelToken":"baz","apiKey":"boo","version":"2.0.6+rev3.prod"} +{"applicationId":78373,"deviceType":"raspberrypi3","appUpdatePollInterval":3000,"listenPort":2345,"vpnPort":443,"apiEndpoint":"https://api.resin.io","registryEndpoint":"registry2.resin.io","deltaEndpoint":"https://delta.resin.io","mixpanelToken":"baz","apiKey":"boo","version":"2.0.6+rev3.prod"} diff --git a/tools/dind/start-resin-supervisor b/tools/dind/start-resin-supervisor index 8c497a57..6e920238 100755 --- a/tools/dind/start-resin-supervisor +++ b/tools/dind/start-resin-supervisor @@ -63,10 +63,7 @@ configIsUnchanged() { if hasValueChanged "BOOT_MOUNTPOINT" "$BOOT_MOUNTPOINT" "$SUPERVISOR_CONTAINER_ENV_JSON" || \ hasValueChanged "REGISTRY_ENDPOINT" "$REGISTRY_ENDPOINT" "$SUPERVISOR_CONTAINER_ENV_JSON" || \ - hasValueChanged "PUBNUB_SUBSCRIBE_KEY" "$PUBNUB_SUBSCRIBE_KEY" "$SUPERVISOR_CONTAINER_ENV_JSON" || \ - hasValueChanged "PUBNUB_PUBLISH_KEY" "$PUBNUB_PUBLISH_KEY" "$SUPERVISOR_CONTAINER_ENV_JSON" || \ hasValueChanged "MIXPANEL_TOKEN" "$MIXPANEL_TOKEN" "$SUPERVISOR_CONTAINER_ENV_JSON" || \ - hasValueChanged "DELTA_ENDPOINT" "$DELTA_ENDPOINT" "$SUPERVISOR_CONTAINER_ENV_JSON" || \ hasValueChanged "LED_FILE" "${LED_FILE}" "$SUPERVISOR_CONTAINER_ENV_JSON" || \ hasValueChanged "LISTEN_PORT" "$LISTEN_PORT" "$SUPERVISOR_CONTAINER_ENV_JSON" || \ hasValueChanged "SUPERVISOR_IMAGE" "${SUPERVISOR_IMAGE}:${SUPERVISOR_TAG}" "$SUPERVISOR_CONTAINER_ENV_JSON" || \ @@ -97,10 +94,7 @@ runSupervisor() { -e DOCKER_SOCKET=/var/run/balena-engine.sock \ -e "BOOT_MOUNTPOINT=$BOOT_MOUNTPOINT" \ -e "REGISTRY_ENDPOINT=$REGISTRY_ENDPOINT" \ - -e "PUBNUB_SUBSCRIBE_KEY=$PUBNUB_SUBSCRIBE_KEY" \ - -e "PUBNUB_PUBLISH_KEY=$PUBNUB_PUBLISH_KEY" \ -e "MIXPANEL_TOKEN=$MIXPANEL_TOKEN" \ - -e "DELTA_ENDPOINT=$DELTA_ENDPOINT" \ -e "LED_FILE=${LED_FILE}" \ -e "LISTEN_PORT=$LISTEN_PORT" \ -e "SUPERVISOR_IMAGE=${SUPERVISOR_IMAGE}:${SUPERVISOR_TAG}" \