<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Biswarup Adhikari</title>
    <description>The latest articles on DEV Community by Biswarup Adhikari (@biswarupadhikari).</description>
    <link>https://dev.to/biswarupadhikari</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F979674%2F44b545b6-3209-482a-99f5-628781db6f96.jpeg</url>
      <title>DEV Community: Biswarup Adhikari</title>
      <link>https://dev.to/biswarupadhikari</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/biswarupadhikari"/>
    <language>en</language>
    <item>
      <title>Streamlining React App Deployments: Overcoming Docker Build Args Limitations with `env-config.js`</title>
      <dc:creator>Biswarup Adhikari</dc:creator>
      <pubDate>Wed, 03 Apr 2024 12:59:23 +0000</pubDate>
      <link>https://dev.to/biswarupadhikari/streamlining-react-app-deployments-overcoming-docker-build-args-limitations-with-env-configjs-1j99</link>
      <guid>https://dev.to/biswarupadhikari/streamlining-react-app-deployments-overcoming-docker-build-args-limitations-with-env-configjs-1j99</guid>
      <description>&lt;p&gt;When deploying React applications or any javascript based frontend applications such as Angular, Vuejs etc across various environments like development, staging, and production, developers often face a common challenge with Docker: the limitations of build arguments (&lt;code&gt;--build-arg&lt;/code&gt;). Build arguments are frequently used to pass environment-specific configurations to a Docker image at build time. However, this approach hardcodes the values into the image, reducing flexibility and requiring separate builds for each environment. This article explores an alternative strategy using &lt;code&gt;env-config.js&lt;/code&gt;, enhancing the reusability and flexibility of Docker images across different environments.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Understanding the Problem with Docker Build Args&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Docker's build arguments allow you to pass configuration during the image build process. For instance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="k"&gt;ARG&lt;/span&gt;&lt;span class="s"&gt; REACT_APP_API_URL&lt;/span&gt;
&lt;span class="k"&gt;ENV&lt;/span&gt;&lt;span class="s"&gt; REACT_APP_API_URL=$REACT_APP_API_URL&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;While this method is effective for injecting environment variables into the Docker image, it has a significant drawback. The variables become hardcoded into the image. As a result, the same image cannot be reused across different environments (dev, staging, prod) without rebuilding it for each one. This leads to a lack of flexibility and increased complexity in your CI/CD pipeline.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;The Solution: &lt;code&gt;env-config.js&lt;/code&gt;&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;A more flexible approach involves using a JavaScript file, &lt;code&gt;env-config.js&lt;/code&gt;, generated dynamically at runtime. This file is created using a bash script and loaded before your React application starts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"window._env_ = {"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /var/www/html/env-config.js
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"  REACT_APP_API_URL: &lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;REACT_APP_API_URL&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="se"&gt;\"&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; /var/www/html/env-config.js
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"}"&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt; /var/www/html/env-config.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With this setup, the environment variables are not hardcoded into the Docker image. Instead, they are injected at runtime, allowing the same image to be used across multiple environments.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Integrating &lt;code&gt;env-config.js&lt;/code&gt; with Docker&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Here's how to configure the Dockerfile for this approach:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight docker"&gt;&lt;code&gt;&lt;span class="c"&gt;# Build stage for React app&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;node:latest&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;as&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;build&lt;/span&gt;
&lt;span class="k"&gt;WORKDIR&lt;/span&gt;&lt;span class="s"&gt; /app&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; package.json ./&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; yarn.lock ./&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;yarn &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; . ./&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;yarn build

&lt;span class="c"&gt;# Nginx stage&lt;/span&gt;
&lt;span class="k"&gt;FROM&lt;/span&gt;&lt;span class="s"&gt; nginx:alpine&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; --from=build /app/build /var/www/html&lt;/span&gt;
&lt;span class="k"&gt;COPY&lt;/span&gt;&lt;span class="s"&gt; env-to-js.sh /usr/local/bin/&lt;/span&gt;
&lt;span class="k"&gt;RUN &lt;/span&gt;&lt;span class="nb"&gt;chmod&lt;/span&gt; +x /usr/local/bin/env-to-js.sh
&lt;span class="k"&gt;CMD&lt;/span&gt;&lt;span class="s"&gt; ["/bin/sh", "-c", "/usr/local/bin/env-to-js.sh &amp;amp;&amp;amp; nginx -g 'daemon off;'"]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This Dockerfile builds the React app and sets up Nginx to serve it. The critical addition is the &lt;code&gt;env-to-js.sh&lt;/code&gt; script that generates &lt;code&gt;env-config.js&lt;/code&gt; at container startup, injecting the current environment's variables.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Accessing Environment Variables in React&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;In your React application, access these variables from the global &lt;code&gt;window&lt;/code&gt; object:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;apiUrl&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;_env_&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;REACT_APP_API_URL&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;default-api-url&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  &lt;strong&gt;Security Considerations&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;It’s important to note that any information in env-config.js is publicly visible. Be cautious not to include sensitive data like private API keys, secrets etc. Treat &lt;code&gt;env-config.js&lt;/code&gt; as a publicly accessible resource.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Conclusion: Enhanced Flexibility and Reusability&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;By adopting the &lt;code&gt;env-config.js&lt;/code&gt; strategy in your Dockerized React application, you achieve significant flexibility. This approach allows you to use the same Docker image across various environments without the need for separate builds, simplifying your deployment process and enhancing maintainability.&lt;/p&gt;

</description>
      <category>react</category>
      <category>docker</category>
      <category>kubernates</category>
      <category>devops</category>
    </item>
    <item>
      <title>ChronoMate: Your Ultimate Time Zone Companion for Seamless Productivity and Scheduling Ease!</title>
      <dc:creator>Biswarup Adhikari</dc:creator>
      <pubDate>Wed, 02 Aug 2023 06:27:27 +0000</pubDate>
      <link>https://dev.to/biswarupadhikari/chronomate-your-ultimate-time-zone-companion-for-seamless-productivity-and-scheduling-ease-38pb</link>
      <guid>https://dev.to/biswarupadhikari/chronomate-your-ultimate-time-zone-companion-for-seamless-productivity-and-scheduling-ease-38pb</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZQ5m699E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i88vk53yd14oo991mrsg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZQ5m699E--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i88vk53yd14oo991mrsg.png" alt="Image description" width="385" height="608"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In today's interconnected world, global collaboration has become the norm for businesses and individuals alike. However, the challenges of managing time zone differences often lead to confusion, missed opportunities, and reduced productivity. But fear not! ChronoMate, a game-changing Chrome extension, is here to simplify your life and empower you to conquer time zone complexities effortlessly.&lt;/p&gt;

&lt;h2&gt;
  
  
  A user-friendly Interface
&lt;/h2&gt;

&lt;p&gt;ChronoMate's intuitive and user-friendly interface is designed to streamline your experience. With just a few clicks, you can seamlessly switch between various time zones, making scheduling and collaboration a breeze. No more fumbling with multiple clocks or struggling to calculate time differences manually. ChronoMate puts all the information you need at your fingertips, ensuring you're always informed and in control.&lt;/p&gt;

&lt;h2&gt;
  
  
  Stay informed with real-time clocks
&lt;/h2&gt;

&lt;p&gt;One of the standout features of ChronoMate is its ability to display the current time in multiple time zones simultaneously. This real-time clock feature enables you to stay on top of your global commitments and plan your day with precision. Whether you're arranging meetings, setting deadlines, or coordinating tasks, ChronoMate ensures you never miss a beat.&lt;/p&gt;

&lt;h2&gt;
  
  
  Custom Time Selection and Time Zone Converter
&lt;/h2&gt;

&lt;p&gt;ChronoMate goes beyond basic time zone tracking. You can select a specific time in any time zone, allowing you to plan meetings and events with efficiency. Need to coordinate a conference call with team members from different continents? No problem! ChronoMate's time zone converter effortlessly transforms any time to another time zone with absolute precision and accuracy.&lt;/p&gt;

&lt;h2&gt;
  
  
  Personalized Settings
&lt;/h2&gt;

&lt;p&gt;We understand that everyone has unique preferences when it comes to working across time zones. With ChronoMate, you can personalize your settings to prioritize frequently used time zones, ensuring your workflow is optimized for maximum productivity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Offline Mode
&lt;/h2&gt;

&lt;p&gt;Worried about accessing your time zone data during internet outages or while traveling? ChronoMate has you covered! With its offline mode, you can still access your saved time zone data, keeping you prepared even in the absence of an internet connection.&lt;/p&gt;

&lt;h2&gt;
  
  
  Transform Your Productivity with ChronoMate
&lt;/h2&gt;

&lt;p&gt;ChronoMate is not just another tool; it's your ultimate time zone companion, built to cater to the needs of business professionals, remote workers, and globetrotting individuals. Say goodbye to the headache of managing time zones and welcome a new era of seamless productivity and time management.&lt;/p&gt;

&lt;h2&gt;
  
  
  Join the ChronoMate Revolution!
&lt;/h2&gt;

&lt;p&gt;Ready to embrace the power of ChronoMate? The Chrome extension is just a click away. Download ChronoMate today from the Chrome Web Store and experience the unparalleled convenience of managing time zones effortlessly. With ChronoMate by your side, you can conquer time zone complexities and boost your productivity like never before.&lt;/p&gt;

&lt;p&gt;Don't let time zones be a barrier to your success. Embrace ChronoMate, and witness the transformation in your work efficiency. Let ChronoMate take care of time zones, so you can focus on what truly matters - getting things done and achieving your goals, no matter where in the world they take you! 🌏🕰️&lt;/p&gt;

&lt;p&gt;&lt;a href="https://chrome.google.com/webstore/detail/chronomate-time-zone-mast/adnnkfmdgipedgdmpiekokndlkmanann"&gt;https://chrome.google.com/webstore/detail/chronomate-time-zone-mast/adnnkfmdgipedgdmpiekokndlkmanann&lt;/a&gt;&lt;/p&gt;

</description>
      <category>chrome</category>
      <category>extensions</category>
      <category>timezone</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Mirroring GitLab to GitHub: A Step-by-Step Guide with Public Key Authentication</title>
      <dc:creator>Biswarup Adhikari</dc:creator>
      <pubDate>Thu, 02 Mar 2023 06:22:55 +0000</pubDate>
      <link>https://dev.to/biswarupadhikari/mirroring-gitlab-to-github-a-step-by-step-guide-with-public-key-authentication-3c66</link>
      <guid>https://dev.to/biswarupadhikari/mirroring-gitlab-to-github-a-step-by-step-guide-with-public-key-authentication-3c66</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;GitLab and GitHub are two of the most popular code hosting platforms used by developers around the world. Sometimes, you may need to mirror a GitLab repository to a GitHub repository for backup or collaboration purposes. Manually doing this can be time-consuming, especially if you have multiple repositories to mirror. Fortunately, you can automate the process using a shell script. In this article, we will show you how to do this with a simple example shell script.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before we begin, you need to have the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A GitLab account with a repository that you want to mirror to GitHub.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A GitHub account with a repository where you want to mirror the GitLab repository.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Git installed on your local machine.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;SSH keys set up and added to your GitLab and GitHub accounts for authentication.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 1: Set up the Shell Script
&lt;/h3&gt;

&lt;p&gt;To mirror a GitLab repository to a GitHub repository, we will use a shell script. Here is an example script that you can use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="c"&gt;# Define an array that maps GitLab and GitHub repository URLs&lt;/span&gt;
&lt;span class="nb"&gt;declare&lt;/span&gt; &lt;span class="nt"&gt;-A&lt;/span&gt; &lt;span class="nv"&gt;repo_map&lt;/span&gt;&lt;span class="o"&gt;=(&lt;/span&gt;
    &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"https://gitlab.com/username/repo.git"&lt;/span&gt;&lt;span class="o"&gt;]=&lt;/span&gt;&lt;span class="s2"&gt;"https://github.com/username/repo.git"&lt;/span&gt;
    &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"https://gitlab.com/username/other-repo.git"&lt;/span&gt;&lt;span class="o"&gt;]=&lt;/span&gt;&lt;span class="s2"&gt;"https://github.com/username/other-repo.git"&lt;/span&gt;
&lt;span class="o"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;# Loop through the array and mirror each GitLab repository to its corresponding GitHub repository&lt;/span&gt;
&lt;span class="k"&gt;for &lt;/span&gt;gitlab_url &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="p"&gt;!repo_map[@]&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do
    &lt;/span&gt;&lt;span class="nv"&gt;github_url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="k"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;repo_map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$gitlab_url&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="k"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
    &lt;span class="nv"&gt;repo_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;basename&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$gitlab_url&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; .git&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

    &lt;span class="c"&gt;# Clone the GitLab repository&lt;/span&gt;
    git clone &lt;span class="nt"&gt;--mirror&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$gitlab_url&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

    &lt;span class="c"&gt;# Change to the local repository directory&lt;/span&gt;
    &lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$repo_name&lt;/span&gt;&lt;span class="s2"&gt;.git"&lt;/span&gt;

    &lt;span class="c"&gt;# Add the GitHub repository as a remote&lt;/span&gt;
    git remote add github &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$github_url&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

    &lt;span class="c"&gt;# Push all branches and tags to the GitHub repository&lt;/span&gt;
    git push &lt;span class="nt"&gt;--mirror&lt;/span&gt; github

    &lt;span class="c"&gt;# Remove the local repository directory&lt;/span&gt;
    &lt;span class="nb"&gt;cd&lt;/span&gt; ..
    &lt;span class="nb"&gt;rm&lt;/span&gt; &lt;span class="nt"&gt;-rf&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$repo_name&lt;/span&gt;&lt;span class="s2"&gt;.git"&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This script defines an associative array &lt;code&gt;repo_map&lt;/code&gt; that maps GitLab and GitHub repository URLs. The loop then clones each GitLab repository using &lt;code&gt;git clone --mirror&lt;/code&gt;, adds the GitHub repository as a remote using git remote add, and pushes all branches and tags to the GitHub repository using &lt;code&gt;git push --mirror&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Make sure to replace the GitLab and GitHub repository URLs in the &lt;code&gt;repo_map&lt;/code&gt; array with the URLs for your own repositories.&lt;/p&gt;

&lt;p&gt;Save this script to a file, for example, &lt;code&gt;mirror.sh&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Make the Shell Script Executable
&lt;/h3&gt;

&lt;p&gt;Next, we need to make the shell script executable. Run the following command in the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;chmod&lt;/span&gt; +x mirror.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command gives the script execution permission.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 3: Run the Shell Script
&lt;/h3&gt;

&lt;p&gt;Now we can run the shell script to mirror the GitLab repository to the GitHub repository. To do this, run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;./mirror.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This command runs the &lt;code&gt;mirror.sh&lt;/code&gt; script and starts the mirroring process.&lt;/p&gt;

&lt;p&gt;The script will loop through each GitLab repository in the repo_map array, clone it, add the GitHub repository as a remote, and push all branches and tags to the GitHub repository.&lt;/p&gt;

&lt;p&gt;Once the script has finished running, all of your GitLab repositories should be mirrored to your GitHub repositories.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Mirroring GitLab repositories to GitHub repositories can be a tedious process, especially if you have multiple repositories to mirror&lt;/p&gt;

&lt;h4&gt;
  
  
  Notes:
&lt;/h4&gt;

&lt;p&gt;In addition to GitLab and GitHub, this technique can be used to mirror repositories from other code hosting platforms such as Bitbucket, AWS CodeCommit, and others. You simply need to modify the script to use the correct URLs for the repositories that you want to mirror.&lt;/p&gt;

&lt;p&gt;To mirror repositories from other providers, you will need to modify the &lt;code&gt;repo_map&lt;/code&gt; array in the script to use the correct URLs for each repository. For example, if you want to mirror a Bitbucket repository to a GitHub repository, you would replace the GitLab and GitHub URLs in the &lt;code&gt;repo_map&lt;/code&gt; array with the Bitbucket and GitHub URLs respectively.&lt;/p&gt;

&lt;p&gt;Additionally, you may need to modify the SSH keys that you use for authentication depending on the code hosting platform that you are mirroring from and to. However, the process of setting up SSH keys is similar for most code hosting platforms and can usually be done through the user settings or profile pages.&lt;/p&gt;

&lt;p&gt;In conclusion, this shell script can be a powerful tool for automating the process of mirroring repositories between different code hosting platforms, saving you time and effort. With a little bit of modification, you can use this technique to mirror any provider's repositories, including GitLab, GitHub, Bitbucket, AWS CodeCommit, and more.&lt;/p&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>bash</category>
      <category>automation</category>
    </item>
    <item>
      <title>A Quick Guide to Changing Laravel Passwords Using Tinker</title>
      <dc:creator>Biswarup Adhikari</dc:creator>
      <pubDate>Sat, 25 Feb 2023 08:09:01 +0000</pubDate>
      <link>https://dev.to/biswarupadhikari/a-quick-guide-to-changing-laravel-passwords-using-tinker-3fk7</link>
      <guid>https://dev.to/biswarupadhikari/a-quick-guide-to-changing-laravel-passwords-using-tinker-3fk7</guid>
      <description>&lt;p&gt;To change a user's password in Laravel using Tinker, you can follow these steps:&lt;/p&gt;

&lt;p&gt;Step 1: Open your terminal and navigate to your project directory.&lt;/p&gt;

&lt;p&gt;Step 2: Type php artisan tinker to enter the Tinker shell.&lt;/p&gt;

&lt;p&gt;Step 3: Retrieve the user by finding the user instance. For example, if you want to change the password for a user with ID 1, you can use the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; App&lt;span class="se"&gt;\M&lt;/span&gt;odels&lt;span class="se"&gt;\U&lt;/span&gt;ser::find&lt;span class="o"&gt;(&lt;/span&gt;1&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 4: Update the password for the user using the bcrypt function to encrypt the password. For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$user&lt;/span&gt;-&amp;gt;password &lt;span class="o"&gt;=&lt;/span&gt; bcrypt&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'new_password'&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Step 5: Save the changes by calling the save method on the user instance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$user&lt;/span&gt;-&amp;gt;save&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>watercooler</category>
    </item>
  </channel>
</rss>
