You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On this repository, we have two account servers: EnterpriseServer (at fes.domain.com) and FlowCryptComApi (at flowcrypt.com/api). I have just deployed https://flowcrypt.com/shared-tenant-fes/ (same app as the already implemented EnterpriseServer but different instance - as a replacement of flowcrypt.com/api)
In this issue:
rename EnterpriseServer to ExternalService (and FlowCrypt Enterprise Server to FlowCrypt External Service and, enterprise-server.ts to external-service.ts so on)
in this ExternalService top comment change fully independent of flowcrypt.com/api to fully independent of flowcrypt.com/shared-tenant-fes/ and FlowCrypt Enterprise Server (FES) may be deployed on-prem by enterprise customers. to FlowCrypt External Service (FES) can be run individually by each customer at fes.customer.com. When not present, flowcrypt.com/shared-tenant-fes/ will be used.
remove all usage of FlowCryptComApi.accountUpdate. Where there is UI that uses this, remove the UI and its handlers (eg changing message expiration time).
delete FlowCryptComApi class
helpers.ts/isFesUsed should be renamed to isCustomUrlFesUsed along with usage
remove all BackendRes types. Where these types are still used, like AccountServer.accountGetAndUpdateLocalStore, create a type instead. This one in particular can return {clientConfiguration, defaultWebPortalMessageExpire: number}
accountGetAndUpdateLocalStore should continue returning 180 days when isCustomUrlFesUsed else it should return 90 when using sharedTenantUrl
AccountServer.accountUpdate should be removed
AccountUpdate methods messageUpload, messageGatewayUpdate, messageToken should all have else branches that look similar as the if branch, except using sharedTenantFes to do the same thing
I suspect the AccountUpdate class will look odd this way, with a lot of repetition, but I propose to not refactor that further yet. It will make review of this PR much easier, to ensure a mistake wasn't made (it's crucial functionality, and can be easily subtly wrong). Then we can have a separate PR that will refactor AccountUpdate further.
tests themselves SHOULD NOT need to be udpated (I hope), except that mock definitions need to be fixed. In particular, all endpoints on mockBackendEndpoints except for /api/help/error and /api/help/feedback can be removed, and:
move file fes-endpoints.ts to custom-url-fes-endpoints.ts and likewise rename the exported variable
create file shared-tenant-fes-endpoints.ts that is similar to custom-url-fes-endpoints.ts (starting from line export const mockFesEndpoints: HandlersDefinition = { downwards can be copied and edited) except there will be none of the special cases. Name it mockSharedTenantFesEndpoints. Also need to replace in this new file /api/ with /shared-tenant-fes/api/. Otherwise just return one default response per endpoints, always the same, except for client configuraiton. Still need to keep returning request-based client configuration. Previously backend-endpoints was using mockBackendData.getClientConfiguration(email!). You can delete mockBackendData completely, and instead copy contents of mockBackendData.getClientConfiguration into the newly created custom-url-fes-endpoints.ts / /shared-tenant-fes/api/v1/client-configuration endpoint, editing it to ensure it will return correct format.
in all-apis-mock.ts the mockFesEndpoints should be renamed to mockCustomUrlFesEndpoints, and underneath should add mockSharedTenantFesEndpoints
I've tried to list all of the steps to take to make implementation easier, it is quite an involved issue.
reasoning here https://github.com/FlowCrypt/flowcrypt-enterprise-on-prem/issues/4097
On this repository, we have two account servers:
EnterpriseServer(at fes.domain.com) andFlowCryptComApi(at flowcrypt.com/api). I have just deployed https://flowcrypt.com/shared-tenant-fes/ (same app as the already implementedEnterpriseServerbut different instance - as a replacement of flowcrypt.com/api)In this issue:
EnterpriseServertoExternalService(andFlowCrypt Enterprise ServertoFlowCrypt External Serviceand,enterprise-server.tstoexternal-service.tsso on)ExternalServicetop comment changefully independent of flowcrypt.com/apitofully independent of flowcrypt.com/shared-tenant-fes/andFlowCrypt Enterprise Server (FES) may be deployed on-prem by enterprise customers.toFlowCrypt External Service (FES) can be run individually by each customer at fes.customer.com. When not present, flowcrypt.com/shared-tenant-fes/ will be used.FlowCryptComApi.accountUpdate. Where there is UI that uses this, remove the UI and its handlers (eg changing message expiration time).FlowCryptComApiclassisCustomUrlFesUsedalong with usageAccountServeradd three lines:BackendRestypes. Where these types are still used, likeAccountServer.accountGetAndUpdateLocalStore, create a type instead. This one in particular can return{clientConfiguration, defaultWebPortalMessageExpire: number}accountGetAndUpdateLocalStoreshould continue returning180days whenisCustomUrlFesUsedelse it should return90when usingsharedTenantUrlAccountServer.accountUpdateshould be removedAccountUpdatemethodsmessageUpload,messageGatewayUpdate,messageTokenshould all haveelsebranches that look similar as theifbranch, except usingsharedTenantFesto do the same thingAccountUpdateclass will look odd this way, with a lot of repetition, but I propose to not refactor that further yet. It will make review of this PR much easier, to ensure a mistake wasn't made (it's crucial functionality, and can be easily subtly wrong). Then we can have a separate PR that will refactorAccountUpdatefurther.mockBackendEndpointsexcept for/api/help/errorand/api/help/feedbackcan be removed, and:fes-endpoints.tstocustom-url-fes-endpoints.tsand likewise rename the exported variableall-apis-mock.tsthemockFesEndpointsshould be renamed tomockCustomUrlFesEndpoints, and underneath should addmockSharedTenantFesEndpointsI've tried to list all of the steps to take to make implementation easier, it is quite an involved issue.