2022-08-31 06:33:37 +05:00
|
|
|
/*
|
|
|
|
|
This file is part of the Notesnook project (https://notesnook.com/)
|
|
|
|
|
|
|
|
|
|
Copyright (C) 2022 Streetwriters (Private) Limited
|
|
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
2022-08-30 16:13:11 +05:00
|
|
|
|
2022-01-18 12:00:57 +05:00
|
|
|
import { extractHostname } from "./hostname";
|
|
|
|
|
|
2022-08-15 10:57:25 +05:00
|
|
|
function isProduction() {
|
|
|
|
|
return (
|
|
|
|
|
process.env.NODE_ENV === "production" || process.env.NODE_ENV === "test"
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2021-07-24 11:13:41 +05:00
|
|
|
const hosts = {
|
2022-08-15 10:57:25 +05:00
|
|
|
API_HOST: isProduction()
|
|
|
|
|
? "https://api.notesnook.com"
|
|
|
|
|
: "http://localhost:5264",
|
|
|
|
|
AUTH_HOST: isProduction()
|
|
|
|
|
? "https://auth.streetwriters.co"
|
|
|
|
|
: "http://localhost:8264",
|
|
|
|
|
SSE_HOST: isProduction()
|
|
|
|
|
? "https://events.streetwriters.co"
|
|
|
|
|
: "http://localhost:7264",
|
|
|
|
|
SUBSCRIPTIONS_HOST: isProduction()
|
|
|
|
|
? "https://subscriptions.streetwriters.co"
|
|
|
|
|
: "http://localhost:9264",
|
|
|
|
|
ISSUES_HOST: isProduction()
|
|
|
|
|
? "https://issues.streetwriters.co"
|
2022-08-31 06:33:37 +05:00
|
|
|
: "http://localhost:2624"
|
2020-01-20 17:27:18 +05:00
|
|
|
};
|
2020-09-19 11:46:36 +05:00
|
|
|
|
2021-07-24 11:13:41 +05:00
|
|
|
export default hosts;
|
2022-01-18 12:00:57 +05:00
|
|
|
|
|
|
|
|
export const getServerNameFromHost = (host) => {
|
|
|
|
|
const names = {
|
|
|
|
|
[extractHostname(hosts.API_HOST)]: "Notesnook Sync Server",
|
|
|
|
|
[extractHostname(hosts.AUTH_HOST)]: "Authentication Server",
|
|
|
|
|
[extractHostname(hosts.SSE_HOST)]: "Eventing Server",
|
|
|
|
|
[extractHostname(hosts.SUBSCRIPTIONS_HOST)]:
|
|
|
|
|
"Subscriptions Management Server",
|
2022-08-31 06:33:37 +05:00
|
|
|
[extractHostname(hosts.ISSUES_HOST)]: "Bug Reporting Server"
|
2022-01-18 12:00:57 +05:00
|
|
|
};
|
|
|
|
|
return names[host];
|
|
|
|
|
};
|