Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an environment variable for gitlab url #10

Merged
merged 1 commit into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ POSTGRES_USER=root
SLACK_BOT_USER_O_AUTH_ACCESS_TOKEN=SLACK_BOT_USER_O_AUTH_ACCESS_TOKEN
SLACK_SIGNING_SECRET=SLACK_SIGNING_SECRET
EMAIL_DOMAINS=my-domain.com,ext.my-domain.com
GITLAB_URL=https://my-git.domain.com
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,16 @@ Create a `.env` file containing the following variables:
![OAuth token](docs/assets/slack/oauth-token.png)

- `EMAIL_DOMAINS`

Email domains of your organization (separated by comma),
for instance `my-domain.com,ext.my-domain.com`.
Used to find Slack users from Gitlab username.
Note that this means your org has to use the same naming scheme for emails and gitlab username.

- `GITLAB_URL`

The gitlab URL of your organization

If you want Homer to connect to an **external PostgreSQL database**, you can set
the following variables:

Expand Down
2 changes: 1 addition & 1 deletion __mocks__/node-fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { default: realNodeFetch } = jest.requireActual('node-fetch');
let nodeFetchMocks: Record<string, HttpCallMock> = {};

export default (url: string, ...args: any[]) => {
if (url.includes('git.manomano.tech') || url.includes('slack')) {
if (url.includes('my-git.domain.com') || url.includes('slack')) {
if (!nodeFetchMocks[url]) {
// eslint-disable-next-line no-console
console.error(`Non mocked URL: ${url}`);
Expand Down
3 changes: 2 additions & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import type { GitlabMergeRequestState } from '@/core/typings/GitlabMergeRequest';
import { getEnvVariable } from '@/core/utils/getEnvVariable';

export const CHANNEL_NOT_FOUND_SLACK_ERROR = 'channel_not_found';
export const EXPIRED_TRIGGER_ID_ERROR_MESSAGE =
'D’oh! It looks like I took too much time to respond for Slack, could you retry your command? :homer-donut:';
export const EXPIRED_TRIGGER_ID_SLACK_ERROR = 'expired_trigger_id';
export const GENERIC_ERROR_MESSAGE =
"D'oh! Something went wrong :homer-stressed: You will probably find more information on the error on <https://app.datadoghq.eu/logs?cols=host%2Cservice&live=true&messageDisplay=inline&query=service%3A%2Ahomer%2A%20%40env%3Asupport&index=%2A&stream_sort=desc|Datadog>.";
export const GITLAB_URL = 'https://git.manomano.tech';
export const GITLAB_URL = getEnvVariable('GITLAB_URL');
export const HOMER_GITLAB_URL = `${GITLAB_URL}/tools/homer`;
export const HTTP_STATUS_NO_CONTENT = 204;
export const HTTP_STATUS_OK = 200;
Expand Down
2 changes: 1 addition & 1 deletion src/core/typings/GitlabUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export interface GitlabUser {
state: 'active' | 'blocked';
/** ex: josselin.buils */
username: string;
/** URL of user profile (ex: https://git.manomano.tech/josselin.buils) */
/** URL of user profile (ex: https://my-git.domain.com/firstname.lastname) */
web_url: string;
}

Expand Down
Loading