chore(server): enable earlyAccessPreview for canary (#4061)

This commit is contained in:
LongYinan
2023-08-31 14:41:43 +08:00
committed by GitHub
parent 49d203ac57
commit cc00da9325
4 changed files with 14 additions and 2 deletions

View File

@@ -157,6 +157,12 @@ export interface AFFiNEConfig {
* the apollo driver config
*/
graphql: ApolloDriverConfig;
/**
* app features flag
*/
featureFlags: {
earlyAccessPreview: boolean;
};
/**
* object storage Config
*

View File

@@ -106,6 +106,12 @@ export const getDefaultAFFiNEConfig: () => AFFiNEConfig = () => {
get deploy() {
return !this.node.dev && !this.node.test;
},
get featureFlags() {
return {
earlyAccessPreview:
this.node.prod && (this.affine.beta || this.affine.canary),
};
},
https: false,
host: 'localhost',
port: 3010,

View File

@@ -273,7 +273,7 @@ export const NextAuthOptionsProvider: FactoryProvider<NextAuthOptions> = {
return session;
},
signIn: async ({ profile, user }) => {
if (!config.affine.beta || !config.node.prod) {
if (!config.featureFlags.earlyAccessPreview) {
return true;
}
const email = profile?.email ?? user.email;

View File

@@ -107,7 +107,7 @@ export class UserResolver {
})
@Public()
async user(@Args('email') email: string) {
if (this.config.node.prod && this.config.affine.beta) {
if (this.config.featureFlags.earlyAccessPreview) {
const hasEarlyAccess = await this.prisma.newFeaturesWaitingList
.findUnique({
where: { email, type: NewFeaturesKind.EarlyAccess },