chore(server): enable earlyAccessPreview for canary (#4061)
This commit is contained in:
@@ -157,6 +157,12 @@ export interface AFFiNEConfig {
|
|||||||
* the apollo driver config
|
* the apollo driver config
|
||||||
*/
|
*/
|
||||||
graphql: ApolloDriverConfig;
|
graphql: ApolloDriverConfig;
|
||||||
|
/**
|
||||||
|
* app features flag
|
||||||
|
*/
|
||||||
|
featureFlags: {
|
||||||
|
earlyAccessPreview: boolean;
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* object storage Config
|
* object storage Config
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -106,6 +106,12 @@ export const getDefaultAFFiNEConfig: () => AFFiNEConfig = () => {
|
|||||||
get deploy() {
|
get deploy() {
|
||||||
return !this.node.dev && !this.node.test;
|
return !this.node.dev && !this.node.test;
|
||||||
},
|
},
|
||||||
|
get featureFlags() {
|
||||||
|
return {
|
||||||
|
earlyAccessPreview:
|
||||||
|
this.node.prod && (this.affine.beta || this.affine.canary),
|
||||||
|
};
|
||||||
|
},
|
||||||
https: false,
|
https: false,
|
||||||
host: 'localhost',
|
host: 'localhost',
|
||||||
port: 3010,
|
port: 3010,
|
||||||
|
|||||||
@@ -273,7 +273,7 @@ export const NextAuthOptionsProvider: FactoryProvider<NextAuthOptions> = {
|
|||||||
return session;
|
return session;
|
||||||
},
|
},
|
||||||
signIn: async ({ profile, user }) => {
|
signIn: async ({ profile, user }) => {
|
||||||
if (!config.affine.beta || !config.node.prod) {
|
if (!config.featureFlags.earlyAccessPreview) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const email = profile?.email ?? user.email;
|
const email = profile?.email ?? user.email;
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ export class UserResolver {
|
|||||||
})
|
})
|
||||||
@Public()
|
@Public()
|
||||||
async user(@Args('email') email: string) {
|
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
|
const hasEarlyAccess = await this.prisma.newFeaturesWaitingList
|
||||||
.findUnique({
|
.findUnique({
|
||||||
where: { email, type: NewFeaturesKind.EarlyAccess },
|
where: { email, type: NewFeaturesKind.EarlyAccess },
|
||||||
|
|||||||
Reference in New Issue
Block a user