Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ export interface IProjectDetails {
type: string;
status: string;
defaultSubdomain: boolean;
defaultSubdomainExpired?: boolean;
keepDefaultSubdomain?: boolean;
zeroDowntime: boolean;
scale: number;
envs: IEnvs[];
Expand Down
22 changes: 17 additions & 5 deletions src/commands/app/logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,13 @@ export default class AppLogs extends Command {

static aliases = ['logs'];

// Set by `liara deploy`, which has already loaded the plans by the time it
// streams the logs. It isn't a flag so that it can't be set by users.
static maxLogsRetention?: number;

// Also set by `liara deploy`, to show only the release it just created.
static releaseId?: string;

#timestamps = false;
#colorize = false;
#releaseTagMap: Map<string, string> = new Map(); // cache to store releaseId with it's tag
Expand Down Expand Up @@ -143,11 +150,16 @@ export default class AppLogs extends Command {
process.exit(1);
}

const { plans } = await this.got('v1/me').json<{ plans: any }>();
let { maxLogsRetention } = AppLogs;

if (maxLogsRetention === undefined) {
const { plans } = await this.got('v1/me').json<{ plans: any }>();

maxLogsRetention = plans.projectBundlePlans[planID][bundlePlanID]
.maxLogsRetention as number;
}

const maxSince: number =
now -
plans.projectBundlePlans[planID][bundlePlanID].maxLogsRetention * 86400;
const maxSince: number = now - maxLogsRetention * 86400;

let start: number = flags.since
? this.getStart(`${flags.since}`)
Expand All @@ -163,7 +175,7 @@ export default class AppLogs extends Command {
}

// Get releaseId if release flag is provided
let releaseId: string | undefined;
let { releaseId } = AppLogs;
if (release) {
releaseId = await this.getReleaseIdFromTag(project, release);
if (!releaseId) {
Expand Down
Loading
Loading