Skip to content

Commit

Permalink
fix: adding documentation to create your own env file
Browse files Browse the repository at this point in the history
  • Loading branch information
wrujel committed May 20, 2022
1 parent c7edafc commit 18fc20a
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 54 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,8 @@ yarn-error.log*
.vercel

# typescript
*.tsbuildinfo
*.tsbuildinfo

# local env files
.env*.local
.env
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ We need now to get a personal token from your github account.
4) Type a note and click on `public repo`.
5) Click on Generate token.
6) Then copy token generated that start with `ghp_`.
7) Copy in file `.env`, after variable `API_TOKEN=`.
7) Create a new file name `.env` in folder `github-history/backend/`
8) Paste token in file `.env`, after variable `API_TOKEN=`.

### Running server
Commands to run backend server, use `start:dev` if you want to automatically reset server after saving changes.
Expand Down
4 changes: 0 additions & 4 deletions backend/.env

This file was deleted.

41 changes: 0 additions & 41 deletions backend/k8s/deployment.yaml

This file was deleted.

8 changes: 4 additions & 4 deletions backend/src/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class AppService {
};

getUser(user: string): Promise<any> {
const userUrl = this.env.get<string>('API_USERS');
const userUrl = this.env.get<string>('https://api.github.com/users');
return lastValueFrom(
this.http.get<any>(`${userUrl}/${user}`, { headers: this.header }).pipe(
map((res) => res.data),
Expand All @@ -27,7 +27,7 @@ export class AppService {
}

getRepos(user: string): Promise<any> {
const userUrl = this.env.get<string>('API_USERS');
const userUrl = this.env.get<string>('https://api.github.com/users');
return lastValueFrom(
this.http
.get<any>(`${userUrl}/${user}/repos`, { headers: this.header })
Expand All @@ -43,7 +43,7 @@ export class AppService {
}

getBranches(user: string, repo: string): Promise<any> {
const branchUrl = this.env.get<string>('API_REPOS');
const branchUrl = this.env.get<string>('https://api.github.com/repos');
return lastValueFrom(
this.http
.get<any>(`${branchUrl}/${user}/${repo}/branches`, {
Expand All @@ -61,7 +61,7 @@ export class AppService {
}

getCommits(user: string, repo: string, branch: string): Promise<any> {
const commitUrl = this.env.get<string>('API_REPOS');
const commitUrl = this.env.get<string>('https://api.github.com/repos');
return lastValueFrom(
this.http
.get<any>(`${commitUrl}/${user}/${repo}/commits?sha=${branch}`, {
Expand Down
2 changes: 1 addition & 1 deletion backend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';

const PORT = process.env.PORT;
const PORT = process.env.PORT || 8080;

async function bootstrap() {
const app = await NestFactory.create(AppModule, { cors: true });
Expand Down
1 change: 0 additions & 1 deletion frontend/.env.local

This file was deleted.

3 changes: 3 additions & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ yarn-error.log*

# typescript
*.tsbuildinfo

# local env files
.env*.local
2 changes: 1 addition & 1 deletion frontend/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Image from "next/image";
import { useEffect, useState } from "react";
import styles from "../styles/Home.module.css";

const serverUrl = process.env.NEXT_PUBLIC_SERVER_URL;
const serverUrl = process.env.NEXT_PUBLIC_SERVER_URL || "http://localhost:8080";

/**
* Home Page
Expand Down

1 comment on commit 18fc20a

@vercel
Copy link

@vercel vercel bot commented on 18fc20a May 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.