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

Can i know which team member is running the application in runtime? #220

Open
nicolasmelo1 opened this issue Apr 14, 2023 · 2 comments
Open

Comments

@nicolasmelo1
Copy link

I want to make development easier for me and my coworkers so i wanted to have baked in documentation for developers in the company.

Let's say i'm creating a simple authentication flow based on OTP in Nest.js

@ApiTags('auth')
@Controller('auth')
export class AuthController {
  constructor(private readonly authService: AuthService) {}

  @Get('/otp')
  @ApiOperation({
    summary:
      'This is used for logging the user in when testing the app. It will send to you an OTP code to your phone number. After this you should log in with "/login" endpoint.',
  })
  @ApiQuery({
    name: 'phoneNumber',
    description: 'The phone number to send the OTP code to, so you can log in.',
    required: true,
    type: String,
    example: '+5511970852396', // this is my phone number, i wanted this to be dynamic then other co-workers that will to run this code don't need to manually change this.
  })
  @ApiResponse({
    status: 200,
    description:
      'If you receive a 200 HTTP status code, the OTP code was sent to the phone number.',
  })
  async sendOtpCode(@Query('phoneNumber') phoneNumber?: string) {
    if (phoneNumber) await this.authService.otp(phoneNumber);
    return;
  }
}

I could create a json file alongside with the team members and we would be able to configure our phone numbers to better document everything.

Another use case might be for mobile development. When i'm developing for mobile and want to run the code on my device i can't use localhost, instead i need to transform the localhost to my actual host of my wifi router.

const client = new QueryClient();
storage.setSecureStorage(secureStorage);
storage.setUnsecureStorage(unsecureStorage);
api.setApiPath(__DEV__ ? config.api.url.replace('localhost', '192.168.0.211') : config.api.url); // i wanted to manually configure the localhost replacement for the user running the application when in development
api.setPrefix('api');

void initializePolyfills(['format-js']);

export default function App() {
    // rest of code
}

With this i can improve the DX on our projects.

@nicolasmelo1
Copy link
Author

Just a teamMember based configuration within app-config would be more than enough i think, then we doesn't leak our personal data to others.

@joelgallant
Copy link
Contributor

Hey! How can app-config help solve this problem? Isn't it possible already to put teamMembers in configuration? Or maybe I've missed how this would work.

An example of what app-config files might look like would help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants