Skip to content
This repository has been archived by the owner on Oct 2, 2023. It is now read-only.

Commit

Permalink
Add API to set update channel (#119)
Browse files Browse the repository at this point in the history
It will only work with a PR to the core repo I have not yet created, but this can be merged before that
  • Loading branch information
AaronDewes authored Jun 5, 2022
1 parent 495b095 commit e0fa22d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions logic/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,3 +418,7 @@ export async function requestReboot(): Promise<systemStatus> {
throw new Error('Unable to request reboot');
}
}

export async function setUpdateChannel(channel: string): Promise<void> {
return runCommand(`set-update-channel ${channel}`);
}
8 changes: 7 additions & 1 deletion routes/v2/system.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Router from '@koa/router';
import {errorHandler} from '@runcitadel/utils';
import {errorHandler, typeHelper} from '@runcitadel/utils';

import * as systemLogic from '../../logic/system.js';
import * as diskLogic from '../../logic/disk.js';
Expand Down Expand Up @@ -143,6 +143,12 @@ router.get('/disk-type', async (ctx, next) => {
await next();
});

router.put('/update-channel', async (ctx, next) => {
typeHelper.isString(ctx.body.channel, ctx);
await systemLogic.setUpdateChannel(ctx.body.channel as string);
await next();
});

router.get('/', async (ctx, next) => {
ctx.body = {os: constants.IS_CITADEL_OS ? 'Citadel OS' : 'unknown'};
await next();
Expand Down

0 comments on commit e0fa22d

Please sign in to comment.