From fdd1a9e8877b4422cc1df2943a2fd7270005ae6b Mon Sep 17 00:00:00 2001 From: Lorenzo Blasa Date: Wed, 10 May 2023 04:35:17 -0700 Subject: [PATCH] Use different location for token depending on build type Summary: For Electron builds, use the same directory as certificates and keys. For headless builds, then use the static directory. Reviewed By: antonk52 Differential Revision: D45728515 fbshipit-source-id: 55a3b143a9289fed23e57cbf6b701a5e48d27332 --- .../flipper-server-core/src/utils/certificateUtils.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/desktop/flipper-server-core/src/utils/certificateUtils.tsx b/desktop/flipper-server-core/src/utils/certificateUtils.tsx index 682b587e0..c665e25d3 100644 --- a/desktop/flipper-server-core/src/utils/certificateUtils.tsx +++ b/desktop/flipper-server-core/src/utils/certificateUtils.tsx @@ -271,8 +271,12 @@ const getStaticFilePath = (filename: string): string => { const tokenFilename = 'auth.token'; const getTokenPath = (): string => { - const path = getStaticFilePath(tokenFilename); - return path; + const config = getFlipperServerConfig(); + if (config.environmentInfo.isHeadlessBuild) { + return getStaticFilePath(tokenFilename); + } + + return getFilePath(tokenFilename); }; export const generateAuthToken = async () => {