<?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: Nir Adler</title>
    <description>The latest articles on DEV Community by Nir Adler (@niradler).</description>
    <link>https://dev.to/niradler</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%2F119349%2F692e1d96-cc48-4131-8911-643f676141e8.jpeg</url>
      <title>DEV Community: Nir Adler</title>
      <link>https://dev.to/niradler</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/niradler"/>
    <language>en</language>
    <item>
      <title>Kubernetes Administrator (CKA)</title>
      <dc:creator>Nir Adler</dc:creator>
      <pubDate>Sat, 03 Dec 2022 12:02:25 +0000</pubDate>
      <link>https://dev.to/niradler/kubernetes-administrator-cka-2el6</link>
      <guid>https://dev.to/niradler/kubernetes-administrator-cka-2el6</guid>
      <description>&lt;p&gt;Hi, I'm doing the CKA certificate and wanted to share some details.&lt;/p&gt;

&lt;p&gt;Purchase the exam certificate at this &lt;a href="https://training.linuxfoundation.org/certification/certified-kubernetes-administrator-cka/" rel="noopener noreferrer"&gt;link&lt;/a&gt;, the exam cost 395$ and you get 2 tries, and 2 demo tries at &lt;a href="https://killer.sh/" rel="noopener noreferrer"&gt;killer.sh&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Preparation course on &lt;a href="https://udemy.com/course/certified-kubernetes-administrator-with-practice-tests" rel="noopener noreferrer"&gt;Udemy&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Kubernetes Overview&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqeuy91vvc911687q2y4z.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqeuy91vvc911687q2y4z.png" alt="k8s.png" width="800" height="478"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Setting up the local environment using &lt;a href="https://minikube.sigs.k8s.io/docs/start" rel="noopener noreferrer"&gt;minikube&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install minikube
minikube start
kubectl get po -A

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

&lt;/div&gt;



&lt;p&gt;you can set a default kube editor altho I recommend staying with vim.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;KUBE_EDITOR=nano

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

&lt;/div&gt;



&lt;p&gt;recommended shell configuration&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;alias k=kubectl # will already be pre-configured
export do="--dry-run=client -o yaml" # k create deploy nginx --image=nginx $do
export now="--force --grace-period 0" # k delete pod x $now

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Introduction to Kubernetes Tools
&lt;/h3&gt;

&lt;p&gt;Check out the kubectl &lt;a href="https://kubernetes.io/docs/reference/kubectl/cheatsheet/" rel="noopener noreferrer"&gt;cheatsheet&lt;/a&gt;, here are some examples of common tasks.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl config get-contexts # print config contexts 
kubectl config use-context my-ctx # switch context to my-ctx
kubectl run nginx --image=nginx # create a pod with name nginx and image nginx:latest
kubectl get pods -o wide # list pods in defauult namespace with extra details
kubectl run nginx --image=nginx --dry-run=client -o yaml # print yaml configuration to run pod nginx
kubectl create deployment --image=nginx nginx --replicas=4 --dry-run=client -o yaml &amp;gt; nginx-deployment.yaml # print yaml configuration to create deployment nginx and direct the output to a new file
kubectl create -f nginx-deployment.yaml # create resources from yaml template
kubectl apply -f nginx-deployment.yaml # apply resources from yaml template
kubectl describe node cluster1-master1 # get resource details
kubectl get pod -A --sort-by=.metadata.uid # print all the pods in the cluster and sort them by the field .metadata.uid
kubectl get pod -o jsonpath="{range .items[*]} {.metadata.name}{.spec.containers[*].resources}{'\n'}" # manipulate output with jsonpath
k expose pod nginx --name nginx-service --port 80
k create ns my-namespace
k -n secret create secret generic mysecret --from-literal=user=myuser --from-literal=pass=1111
kubectl scale --current-replicas=2 --replicas=3 deployment/mysql

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

&lt;/div&gt;



&lt;p&gt;kubectl is not the only tool you will need, make sure to read about &lt;a href="https://kubernetes.io/docs/tasks/administer-cluster/configure-upgrade-etcd/#snapshot-using-etcdctl-options" rel="noopener noreferrer"&gt;etcdctl&lt;/a&gt;, and &lt;a href="https://kubernetes.io/docs/reference/command-line-tools-reference/" rel="noopener noreferrer"&gt;others&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Terminal tools you should know: (short list for some of the advanced question more tools and Linux familiarity is needed)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;vim&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;wc&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;grep&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Topics you should master:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://kubernetes.io/docs/tasks/configure-pod-container/static-pod/" rel="noopener noreferrer"&gt;static pods&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://kubernetes.io/docs/tasks/administer-cluster/configure-upgrade-etcd/" rel="noopener noreferrer"&gt;etcd backup and restore&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://kubernetes.io/docs/concepts/services-networking/service/" rel="noopener noreferrer"&gt;services&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://kubernetes.io/docs/concepts/storage/volumes/" rel="noopener noreferrer"&gt;volumes&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Configurations location:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;/etc/kubernetes&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;/etc/kubernetes/manifests&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;you are allowed to use the Kubernetes docs while solving the exam, you can use these &lt;a href="https://drive.google.com/file/d/1gh9HIYoEP5iW8osayXOGncfSA5xCaN3Z/view?usp=sharing" rel="noopener noreferrer"&gt;bookmarks&lt;/a&gt; for faster navigation in the Kubernetes docs, make sure to use only the CKA exam folder, you are not allowed to search in any site that is not the &lt;a href="https://kubernetes.io/docs" rel="noopener noreferrer"&gt;official docs&lt;/a&gt; while solving the test.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;the bookmarks folder did not create by me, I found it online&lt;/em&gt;&lt;/p&gt;

</description>
      <category>watercooler</category>
      <category>design</category>
      <category>beginners</category>
      <category>career</category>
    </item>
    <item>
      <title>Statikly - No hassle full stack framework</title>
      <dc:creator>Nir Adler</dc:creator>
      <pubDate>Fri, 02 Dec 2022 13:27:34 +0000</pubDate>
      <link>https://dev.to/niradler/statikly-no-hassle-full-stack-framework-4j5m</link>
      <guid>https://dev.to/niradler/statikly-no-hassle-full-stack-framework-4j5m</guid>
      <description>&lt;p&gt;&lt;a href="https://github.com/niradler/statikly" rel="noopener noreferrer"&gt;Statikly&lt;/a&gt; is a full-stack framework for developers who want to create SSR/static sites, great for blog/static/content sites, and amazing for prototype and building internal tools and SEO optimisation.&lt;/p&gt;

&lt;p&gt;Provide an alternative for writing frontend with endless packages and single page application frameworks like React/Vue, more and more heap is growing on server side UI, like next.js and remix, and I wanted to simplify it even more.&lt;/p&gt;

&lt;p&gt;Statikly is based on &lt;a href="https://www.fastify.io/" rel="noopener noreferrer"&gt;fastify&lt;/a&gt; framework and ecosystem plugins, it's trying to not be very opinionated but to support strong defaults.&lt;/p&gt;

&lt;p&gt;let's create our first project&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i -g statikly nodemon
mkdir statikly
cd statikly
statikly init # clone niradler/statikly-demo
npm run watch # visit localhost:3000

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

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frzsqw3zqpdua7we3re3t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frzsqw3zqpdua7we3re3t.png" width="800" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The code behind this page can be found in &lt;code&gt;views/index.ejs&lt;/code&gt; if you wonder where the rest of the HTML coming from we use the layout feature, the page layout is at &lt;code&gt;partials\layout.ejs&lt;/code&gt; configured as env var&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;STATIKLY_LAYOUT=./partials/layout.ejs

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

&lt;/div&gt;



&lt;p&gt;in &lt;code&gt;.env&lt;/code&gt; make sure you don't commit &lt;code&gt;.env&lt;/code&gt; with secrets to git.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;section&amp;gt;
  &amp;lt;h1&amp;gt;Todo example&amp;lt;/h1&amp;gt;
  &amp;lt;a href="/todos"&amp;gt;&amp;lt;button&amp;gt;My Todos&amp;lt;/button&amp;gt;&amp;lt;/a&amp;gt;
&amp;lt;/section&amp;gt;

&amp;lt;figure&amp;gt;
  &amp;lt;img src="public/image.jpg" alt="Minimal landscape" /&amp;gt;
&amp;lt;/figure&amp;gt;

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

&lt;/div&gt;



&lt;p&gt;Go ahead and play with the demo todo app to figure out how you can pass data to your view with loaders, checkout the todos loader for example &lt;code&gt;views\todos\loader.js&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Supported env vars:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;NODE_ENV=production # optional: set in production
STATIKLY_ROOT= # optional: set to override current folder
STATIKLY_STATIC_FOLDER=public # optional: for other public folder
STATIKLY_TEMPLATE=ejs # optional: template engine to use for the complete list @fastify/view
STATIKLY_LAYOUT= # optional: layout path
STATIKLY_VIEWS=views # optional: for other views folder
STATIKLY_PASSWORD=1234 # optional: basic auth
STATIKLY_USERNAME=user # optional: basic auth

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

&lt;/div&gt;



&lt;p&gt;Another helpful command wil be running &lt;code&gt;statikly --help&lt;/code&gt;&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>motivation</category>
      <category>startup</category>
    </item>
    <item>
      <title>Serverless Authentication with Golang</title>
      <dc:creator>Nir Adler</dc:creator>
      <pubDate>Mon, 04 Jul 2022 12:40:16 +0000</pubDate>
      <link>https://dev.to/niradler/serverless-authentication-with-golang-6o1</link>
      <guid>https://dev.to/niradler/serverless-authentication-with-golang-6o1</guid>
      <description>&lt;p&gt;Almost every project needs authentication to serve secure user content.&lt;/p&gt;

&lt;p&gt;For most of my side projects, I prefer to pay per use for cost optimization.&lt;/p&gt;

&lt;p&gt;continuing my experiment with Golang, I created Golang service that's going to run inside AWS Lambda function and store the data in Dynmodb database, I'm using serverless AWS services to fulfil my requirement of cost optimize service.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/niradler/serverless-auth-go"&gt;GitHub repo&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Email/password login&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Forgot password&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Provider login using google/github and more&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Multi tenant(orgs)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Store user data on signup&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Basic roles&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Invite users&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Emails template&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;JWT&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Supported routes:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;| method | route | payload | Role | public | description |&lt;br&gt;
| POST | /v1/auth/login | email, password | | true | Login |&lt;br&gt;
| POST | /v1/auth/login/email | email | | true | Passwordless Login |&lt;br&gt;
| POST | /v1/auth/signup | email, password, data | | true | Signup |&lt;br&gt;
| GET | /v1/auth/validate | | | true | ValidateToken |&lt;br&gt;
| POST | /v1/auth/renew | | | false | Get new Token |&lt;br&gt;
| GET | /v1/auth/provider/:provider | | | true | Login with provider |&lt;br&gt;
| GET | /v1/auth/provider/:provider/callback | | | true | Validate provider login |&lt;br&gt;
| GET | /v1/users/me | | | true | Health check |&lt;br&gt;
| PUT | /v1/users/me | data | | false | Update user data |&lt;br&gt;
| PUT | /v1/users/me/password | password,repeated password | | false | Update user password |&lt;br&gt;
| POST | /v1/orgs | name | | false | Create Org |&lt;br&gt;
| POST | /v1/orgs/:orgId/invite | email, role | admin | false | Invite user to me org |&lt;br&gt;
| GET | /v1/orgs/:orgId/users | | admin | false | Get org users |&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Cloudflare automatic DNS update for homelab</title>
      <dc:creator>Nir Adler</dc:creator>
      <pubDate>Sat, 26 Mar 2022 08:31:40 +0000</pubDate>
      <link>https://dev.to/niradler/cloudflare-automatic-dns-update-for-homelab-4716</link>
      <guid>https://dev.to/niradler/cloudflare-automatic-dns-update-for-homelab-4716</guid>
      <description>&lt;p&gt;First of all, I love Cloudflare, I think they have a great product, I use Cloudflare to manage all my DNS, anyone that has a homelab setup knows you need to figure out a way to keep Cloudflare IP update if your home IP is changed, there are many great solutions out there but I love to create my own tools, so I created &lt;a href="https://github.com/niradler/cloudflaresync"&gt;cloudflaresync&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;My home lab setup is a set of docker-compose files, everything is dockerized so this was the obvious choice, I'm trying to learn Golang so written in Go, and the code is very simple, but taylormade to my need.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# docker-compose
version: '3.4'

services:
  cloudflaresync:
    image: niradler/cloudflaresync
    env_file:
      - .env

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

&lt;/div&gt;



&lt;p&gt;The code is very straightforward, we get the configuration from a set of env vars, and configure a cron task to run every x time to update DNS records with new IP, I'm also using it to create new records when a new service is created.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// main.go
package main

import (
    ...

    "github.com/cloudflare/cloudflare-go"
    "github.com/joho/godotenv"
    "github.com/robfig/cron/v3"
)

....

func main() {
    err := godotenv.Load()
    if err != nil {
        log.Println("Error loading .env file")
    }
    updateRecords()
    log.Println("Start cron", time.Now())
    cronExpression, exist := os.LookupEnv("CRON")
    if !exist {
        cronExpression = "0 * * * *"
    }
    log.Println("cron:", cronExpression)
    c := cron.New()
    id, err := c.AddFunc(cronExpression, updateRecords)
    if err != nil {
        log.Fatal("cron AddFunc error:", err)
    }
    log.Println("cron id:", id)
    c.Start()
    log.Println("Cron Info: ", c.Entries())

    go forever()

    quitChannel := make(chan os.Signal, 1)
    signal.Notify(quitChannel, syscall.SIGINT, syscall.SIGTERM)
    &amp;lt;-quitChannel

    fmt.Println("done")
}

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

&lt;/div&gt;



&lt;p&gt;Supported env vars:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CLOUDFLARE_API_TOKEN=&amp;lt;key&amp;gt;
CLOUDFLARE_DOMAIN=example.com
CLOUDFLARE_SUB_DOMAINS=test,home
CRON=*/2 * * * *
PROXIED=true

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

&lt;/div&gt;



&lt;p&gt;Running example for raspberry pi.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run --name cloudflaresync --env CLOUDFLARE_API_TOKEN=&amp;lt;key&amp;gt; --env CLOUDFLARE_SUB_DOMAINS=&amp;lt;app,home&amp;gt; --env CLOUDFLARE_DOMAIN=&amp;lt;example.com&amp;gt; --restart unless-stopped niradler/cloudflaresync:armv7

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Policyer Github Action</title>
      <dc:creator>Nir Adler</dc:creator>
      <pubDate>Sun, 05 Dec 2021 22:14:26 +0000</pubDate>
      <link>https://dev.to/niradler/policyer-github-action-4625</link>
      <guid>https://dev.to/niradler/policyer-github-action-4625</guid>
      <description>&lt;p&gt;My submission to the GitHub Actions x DEV Hackathon 2021!&lt;/p&gt;

&lt;h3&gt;
  
  
  My Workflow
&lt;/h3&gt;

&lt;p&gt;Policyer is an open-source project (more like a vision) I created after being inspired by policy engines that become very popular lately (&lt;a href="https://www.openpolicyagent.org/"&gt;OPA&lt;/a&gt;,&lt;a href="https://github.com/bridgecrewio/checkov"&gt;Checkov&lt;/a&gt;)&lt;br&gt;&lt;br&gt;
Policyer going to focus on providing a platform to run and create meaningful reports, data engagement and a plugin system to let you provide any data, sometimes it can be k8s YAML and in other cases, it can be user data.&lt;/p&gt;
&lt;h2&gt;
  
  
  Policyer Action
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://github.com/niradler/policyer-github"&gt;policyer-action&lt;/a&gt; lets you the option to run &lt;a href="https://github.com/niradler/policyer"&gt;policyer&lt;/a&gt; as part of your CI process, in my example I'm going to validate GitHub SDK calls.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;The provider is like a plugin for policyer engine, it provides the data so the engine can run it against the checks (polciies)&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It's important for me to emphasise that Policyer provide a platform, and eventually I will want to see a marketplace full of people custom providers.&lt;br&gt;&lt;br&gt;
The action can use any provider either local or published to NPM (support for private registries is on the way). In my example, I created a simple provider to run GitHub SDK calls.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/niradler/policyer-github"&gt;Example Repo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example Check:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---
configuration:
  provider: github-provider
  type: rest
  validEvents:
    - pull_request
    - push
  domain: pulls
  action: listRequestedReviewers
  args:
    owner: context.payload.pull_request.base.user.login
    repo: context.payload.pull_request.base.repo.name
    pull_number: context.payload.pull_request.number
checks:
  - id: validate-reviewers
    name: check if reviewers exists.
    severity: High
    steps:
      - path: data.users
        condition: includes
        value: "nirtester"
        utility: map
        utilityProps:
          - "login"

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

&lt;/div&gt;



&lt;p&gt;(just a reminder this is a policy example and the GitHub action will evaluate it and output it as a report)&lt;/p&gt;

&lt;p&gt;Check flow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;first of all we setup the configuration section where we can provide metadata for the check, in this example I'm asking the provider to do an SDK call:&lt;br&gt;&lt;br&gt;
SDK[pulls]&lt;a href="//%7B%20%20&amp;lt;br&amp;gt;%0Aowner:%20...pull_request.base.user.login%20%20&amp;lt;br&amp;gt;%0Arepo:%20...pull_request.base.repo.name%20%20&amp;lt;br&amp;gt;%0Apull_number:%20...pull_request.number%20%20&amp;lt;br&amp;gt;%0A%7D"&gt;listRequestedReviewers&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;a href="https://octokit.github.io/rest.js/v18#pulls-list-requested-reviewers"&gt;octokit docs&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;next, we going to dive into the actual policy, in this policy we want to verify a certain user is a reviewer, so after the call I'm going to point to the "users" array, then use the condition includes ([...users].includes(value)), utilities function by default includes all &lt;a href="https://lodash.com/"&gt;Lodash&lt;/a&gt; functions, you can add custom utilities in the provider level.&lt;br&gt;&lt;br&gt;
I'm going to use the map utility function to prepare an array of reviewers' usernames.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;the final step is the results:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Submission Category:
&lt;/h3&gt;

&lt;p&gt;Wacky Wildcards&lt;/p&gt;

&lt;h3&gt;
  
  
  Action YAML
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Add github action file .github/workflows/policyer.yml
name: Policyer

on: [pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Policyer GitHub Action
        uses: policyerorg/policyer-action@v0.0.3-alpha
        with:
          verbose: false
          provider: policyer-github
          internal: false
          checks_path: ./checks

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Additional Resources / Info
&lt;/h2&gt;

&lt;p&gt;Visit &lt;a href="https://www.policyer.org/"&gt;Policyer&lt;/a&gt; for more information this is just the beginning&lt;/p&gt;

&lt;h2&gt;
  
  
  Packages used
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;chalk&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;figlet&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;jmespath&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;lodash&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;moment&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;yaml&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;yargs&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;@actions/core/github&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Policyer Action</title>
      <dc:creator>Nir Adler</dc:creator>
      <pubDate>Sun, 05 Dec 2021 21:54:55 +0000</pubDate>
      <link>https://dev.to/niradler/policyer-action-2bhb</link>
      <guid>https://dev.to/niradler/policyer-action-2bhb</guid>
      <description>&lt;h3&gt;
  
  
  My Workflow
&lt;/h3&gt;

&lt;p&gt;Policyer is an open source project (more like a vision) I created after inspired by policy engines that become very popular lately (&lt;a href="https://www.openpolicyagent.org/"&gt;OPA&lt;/a&gt;,&lt;a href="https://github.com/bridgecrewio/checkov"&gt;Checkov&lt;/a&gt;)&lt;br&gt;
Policyer going to focus on providing platform to run and create meaningful reports, data engagement and plugin system to let you provide any data, some time it can be k8s yaml and in other it can be user data.&lt;/p&gt;
&lt;h2&gt;
  
  
  Policyer Action
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://github.com/policyerorg/policyer-action"&gt;policyer-action&lt;/a&gt; let you the option to run Policyer as part of your CI process, in my example I'm going to validate GitHub SDK calls.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Provider is like a plugin for policyer engine, it provide the data so the engine can run it against the checks (polciies)&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Its important for me to emphasize that Policyer provide a platform, and eventually I will want to see marketplace full of custom providers.&lt;br&gt;
The action can use any provider either local or published to NPM (support for private registries is on the way). In my example I created a simple provider to run GitHub SDK calls.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/niradler/policyer-github"&gt;Example Repo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Example Check:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;configuration&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;provider&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;github-provider&lt;/span&gt;
  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;rest&lt;/span&gt;
  &lt;span class="na"&gt;validEvents&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;pull_request&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;push&lt;/span&gt;
  &lt;span class="na"&gt;domain&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;pulls&lt;/span&gt;
  &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;listRequestedReviewers&lt;/span&gt;
  &lt;span class="na"&gt;args&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;owner&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;context.payload.pull_request.base.user.login&lt;/span&gt;
    &lt;span class="na"&gt;repo&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;context.payload.pull_request.base.repo.name&lt;/span&gt;
    &lt;span class="na"&gt;pull_number&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;context.payload.pull_request.number&lt;/span&gt;
&lt;span class="na"&gt;checks&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;validate-reviewers&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;check if reviewers exists.&lt;/span&gt;
    &lt;span class="na"&gt;severity&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;High&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;data.users&lt;/span&gt;
        &lt;span class="na"&gt;condition&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;includes&lt;/span&gt;
        &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;nirtester"&lt;/span&gt;
        &lt;span class="na"&gt;utility&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;map&lt;/span&gt;
        &lt;span class="na"&gt;utilityProps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;login"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(just a reminder this is a policy example and the Github action will evaluate it and output as a report)&lt;/p&gt;

&lt;p&gt;Check flow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;first of all we setup the configuration section where we can provider meta data for the check, in this example I'm asking from the provider to do an SDK call:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SDK[pulls][listRequestedReviewers]({
                  owner: ...pull_request.base.user.login
                  repo: ...pull_request.base.repo.name
                  pull_number: ...pull_request.number
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://octokit.github.io/rest.js/v18#pulls-list-requested-reviewers"&gt;octokit docs&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;next we going to dive in to the actual policy, in this policy we want to verify a certain user is a reviewer, so after the call im going to point to the "users" array, then use the condition includes ([...users].includes(value)), utilities function by default includes all &lt;a href="https://lodash.com/"&gt;Lodash&lt;/a&gt; functions, you can add custom utilities in the provider level.
I'm going to use the map utility function to prepare an array of reviewers usernames.&lt;/li&gt;
&lt;li&gt;final step is the results:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  ____       _ _                      
 |  _ \ ___ | (_) ___ _   _  ___ _ __ 
 | |_) / _ \| | |/ __| | | |/ _ \ '__|
 |  __/ (_) | | | (__| |_| |  __/ |   
 |_|   \___/|_|_|\___|\__, |\___|_|   
                      |___/           
Visit us at policyer.org
Event name: pull_request
Valid events: pull_request,push

┌────────────────────┬──────────┬──────────────────────────────┬──────────────┬─────────────────┬───────────┬──────────┐
│      (index)       │ hasError │            check             │ stepsResults │ inspectedValues │  status   │ severity │
├────────────────────┼──────────┼──────────────────────────────┼──────────────┼─────────────────┼───────────┼──────────┤
│ validate-reviewers │  false   │ 'check if reviewers exists.' │   [ true ]   │   [ [Array] ]   │ 'success' │  'High'  │
└────────────────────┴──────────┴──────────────────────────────┴──────────────┴─────────────────┴───────────┴──────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Submission Category:
&lt;/h3&gt;

&lt;p&gt;Wacky Wildcards&lt;/p&gt;

&lt;h3&gt;
  
  
  Action yaml
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Add github action file .github/workflows/policyer.yml
name: Policyer

on: [pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Policyer GitHub Action
        uses: policyerorg/policyer-action@v0.0.3-alpha
        with:
          verbose: false
          provider: policyer-github
          internal: false
          checks_path: ./checks
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Additional Resources / Info
&lt;/h2&gt;

&lt;p&gt;Visit &lt;a href="https://www.policyer.org/"&gt;Policyer&lt;/a&gt; for more information this is just the beginning&lt;/p&gt;

&lt;h2&gt;
  
  
  Packages used
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;chalk&lt;/li&gt;
&lt;li&gt;figlet&lt;/li&gt;
&lt;li&gt;jmespath&lt;/li&gt;
&lt;li&gt;lodash&lt;/li&gt;
&lt;li&gt;moment&lt;/li&gt;
&lt;li&gt;yaml&lt;/li&gt;
&lt;li&gt;yargs&lt;/li&gt;
&lt;li&gt;@actions/core/github&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>actionshackathon21</category>
      <category>github</category>
      <category>opensource</category>
      <category>policyer</category>
    </item>
    <item>
      <title>Policyer - the first JS policy engine</title>
      <dc:creator>Nir Adler</dc:creator>
      <pubDate>Sun, 21 Nov 2021 11:10:57 +0000</pubDate>
      <link>https://dev.to/niradler/policyer-the-first-js-policy-engine-1dg9</link>
      <guid>https://dev.to/niradler/policyer-the-first-js-policy-engine-1dg9</guid>
      <description>&lt;p&gt;Policyer is an open-source project (more like a vision) I created after being inspired by policy engines that become very popular lately (&lt;a href="https://www.openpolicyagent.org/"&gt;&lt;strong&gt;OPA&lt;/strong&gt;&lt;/a&gt;,&lt;a href="https://github.com/bridgecrewio/checkov"&gt;&lt;strong&gt;Checkov&lt;/strong&gt;&lt;/a&gt;)&lt;br&gt;&lt;br&gt;
Policyer going to focus on providing a platform to run and create meaningful reports, data engagement and a plugin system to let you provide any data, sometimes it can be k8s YAML and in other cases, it can be user data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/niradler/policyer"&gt;GitHub repo&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Getting started
&lt;/h3&gt;

&lt;p&gt;checkout the example &lt;a href="https://github.com/niradler/policyer-todo"&gt;repo&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/niradler/policyer-todo
cd policyer-todo
npm i
node cli.js -o ./report.json -p ./checks -i false

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

&lt;/div&gt;



&lt;p&gt;Checks format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;---
configuration:
  provider: todo-provider
  type: resource
  resource: todo
  payload:
    id: 1
checks:
  - id: todo-id-check
    name: check if todo has an id.
    severity: High
    steps:
      - path: id
        condition: equal
        utility: isInteger
        value: true
      - path: id
        condition: equal
        value: 1
  - id: todo-title-check
    name: check if todo has a title.
    severity: Warning
    steps:
      - path: title
        condition: not
        utility: isEmpty
        value: true
  - id: todo-completed-check
    name: check if todo has a valid completed field.
    severity: Warning
    steps:
      - path: completed
        condition: includes
        value:
          - true
          - false

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

&lt;/div&gt;



&lt;p&gt;A check is a set of conditions or policies to enforce, many utilities can help you build complex policies, and you can also add your own when writing your provider.&lt;/p&gt;

&lt;p&gt;Policyer is modular, and by nature prefer to be behind the scene and let you customise the user-facing side by the Provider as best fit to your need.&lt;/p&gt;

&lt;p&gt;checkout the example repos, contribution is welcome.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Lyve Cloud hackathon Submission - 1st Place</title>
      <dc:creator>Nir Adler</dc:creator>
      <pubDate>Mon, 26 Jul 2021 21:43:56 +0000</pubDate>
      <link>https://dev.to/niradler/lyve-cloud-hackathon-submission-1st-place-2koo</link>
      <guid>https://dev.to/niradler/lyve-cloud-hackathon-submission-1st-place-2koo</guid>
      <description>&lt;p&gt;&lt;em&gt;Introducing a new approach to cloud storage. Lyve Cloud from Seagate is your simple, trusted and efficient storage as a service. Long-term cost predictability means youll never be surprised by your cloud bill. Put your data to work with always-on availability, world-class security, and cloud flexibility from the global leader in mass data storage management.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;What is &lt;a href="https://github.com/niradler/s3-syncer"&gt;s3-syncer&lt;/a&gt;?&lt;/p&gt;

&lt;p&gt;s3 synchronization automation, deploy syncer to your AWS account and connect to the bucket you wish to sync with Lyve Cloud storage. using an s3 notification syncer will reflect any change in the source bucket and also in the target bucket and keep them in sync.&lt;/p&gt;

&lt;p&gt;Demo: &lt;a href="https://www.loom.com/share/11e098376d8548ddb35a1f6ec4266e2e"&gt;https://www.loom.com/share/11e098376d8548ddb35a1f6ec4266e2e&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Presentation:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.israelclouds.com/news/seagate-cloud-hackathon-winners%EF%BF%BChttps://lyvehack.startisrael.co.il/%EF%BF%BChttps://www.linkedin.com/posts/niradler_first-place-had-a-great-experience-activity-6831281878838849538-mUp5"&gt;https://www.israelclouds.com/news/seagate-cloud-hackathon-winners&lt;br&gt;&lt;br&gt;
https://lyvehack.startisrael.co.il/&lt;br&gt;&lt;br&gt;
https://www.linkedin.com/posts/niradler_first-place-had-a-great-experience-activity-6831281878838849538-mUp5&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vyGJcqaB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media-exp1.licdn.com/dms/image/C4D22AQG-CD9_VptqeA/feedshare-shrink_1280/0/1628704518241%3Fe%3D1672876800%26v%3Dbeta%26t%3Dg1jn22Rl2-U_Tfhk6HMFGvpyiBe1T7tQoSAmWNkOWxY" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vyGJcqaB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://media-exp1.licdn.com/dms/image/C4D22AQG-CD9_VptqeA/feedshare-shrink_1280/0/1628704518241%3Fe%3D1672876800%26v%3Dbeta%26t%3Dg1jn22Rl2-U_Tfhk6HMFGvpyiBe1T7tQoSAmWNkOWxY" alt="" width="880" height="1173"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>AWS CloudFormation Outputs</title>
      <dc:creator>Nir Adler</dc:creator>
      <pubDate>Sun, 14 Mar 2021 12:31:44 +0000</pubDate>
      <link>https://dev.to/niradler/aws-cloudformation-outputs-1i5o</link>
      <guid>https://dev.to/niradler/aws-cloudformation-outputs-1i5o</guid>
      <description>&lt;p&gt;My favourite way to deploy resources on AWS is to use Cloudformation (cf), I'm using CDK/Serverless/SST to create my Cloudformation templates.&lt;/p&gt;

&lt;p&gt;often you will want to share data between stacks, the recommended way will be stack outputs, to use this output in build (CI/CD) time I needed an easy tool to pull the output into a machine-readable file, for this task I created &lt;a href="https://github.com/niradler/cfexport"&gt;cfexport&lt;/a&gt; npm module.&lt;/p&gt;

&lt;p&gt;let's look at the following example, we have cf template that deploys our API to AWS APIgateway service, next we have a pipeline to build our client code and upload it to s3, during the build we want to transfer our APIgateway URL to the client build script.&lt;/p&gt;

&lt;p&gt;let's look at how we do that with cfexport&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i cfexport

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

&lt;/div&gt;



&lt;p&gt;next, let's update our scripts filed in &lt;code&gt;package.json&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"pre-build":"cfexport compile -v --file \"./.env.template\" --region us-east-1 --output \"./.env\" --format \".env\""

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

&lt;/div&gt;



&lt;p&gt;and create our template file &lt;code&gt;.env.template&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;REACT_APP_APPLICATION_URL=DEV-APIGATEWAY-URL // you can use --prefix DEV- and then just put APIGATEWAY-URL
REACT_APP_IGNORE_PARAM=!dont-change // value starting with ! will be ignored.

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

&lt;/div&gt;



&lt;p&gt;running &lt;code&gt;npm run pre-build&lt;/code&gt; will create &lt;code&gt;.env&lt;/code&gt; file, and replace &lt;code&gt;DEV-APIGATEWAY-URL&lt;/code&gt; value with the export value (export name should be = &lt;code&gt;DEV-APIGATEWAY-URL&lt;/code&gt;), values starting with ! will be ignored and ! will be removed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;REACT_APP_APPLICATION_URL=https://{restapi_id}.execute-api.{region}.amazonaws.com/{stage_name}/
REACT_APP_IGNORE_PARAM=dont-change

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Cortx hackathon Submission - 2nd Place</title>
      <dc:creator>Nir Adler</dc:creator>
      <pubDate>Fri, 11 Dec 2020 22:41:11 +0000</pubDate>
      <link>https://dev.to/niradler/cortx-hackathon-submission-2nd-place-2489</link>
      <guid>https://dev.to/niradler/cortx-hackathon-submission-2nd-place-2489</guid>
      <description>&lt;p&gt;&lt;a href="https://github.com/Seagate/cortx"&gt;CORTX&lt;/a&gt; is a distributed object storage system designed for great efficiency, massive capacity, and high HDD-utilization. CORTX is 100% Open Source&lt;/p&gt;

&lt;p&gt;I choose to leverage the advanced storage with great compatibility for creating Cloudinary clone, for those who don't know Cloudinary is a saas platform to manage images at scale, they have features like editing images on the fly to the size you need and many more, the project called CORTX-Images, you can find the code &lt;a href="https://github.com/niradler/cortx-images"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Demo:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lnWk9Zap--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://github.com/niradler/cortx-images/raw/master/static/demo.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lnWk9Zap--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://github.com/niradler/cortx-images/raw/master/static/demo.gif" alt="" width="880" height="434"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Presentation:&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Commit secrets to Git (encrypted)</title>
      <dc:creator>Nir Adler</dc:creator>
      <pubDate>Sat, 04 Apr 2020 15:27:31 +0000</pubDate>
      <link>https://dev.to/niradler/commit-secrets-to-git-encrypted-3pfh</link>
      <guid>https://dev.to/niradler/commit-secrets-to-git-encrypted-3pfh</guid>
      <description>&lt;p&gt;As part of the covid-19 extra free time, I'm learning google cloud and terraform.&lt;/p&gt;

&lt;p&gt;My first experiment was to deploy a simple docker file to cloud run service and to set up a custom domain.&lt;/p&gt;

&lt;p&gt;When I got the results needed, I wanted to commit the files to Github, but I've found out that the terraform files can expose secrets. To avoid using a third party solution, I decided to use a tool to encrypt the files before committing. I looked for a simple solution, self-contained and portable, so I decided to create my own solution.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/niradler/git-secrets"&gt;git-secrets&lt;/a&gt; - simple npm package that can be used with husky (git hooks), to transparent encrypt and decrypt files in your repo.&lt;/p&gt;

&lt;p&gt;Setup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i -S git-secrets husky

  "scripts": {
    "start": "node src/server.js",
    "infra:init": "terraform init",
    "infra:plan": "terraform plan",
    "infra:deploy": "terraform apply",
    "infra:destroy": "terraform destroy",
    "secret:init": "./node_modules/.bin/git-secrets init",
    "secret:hide": "./node_modules/.bin/git-secrets hide",
    "secret:reveal": "./node_modules/.bin/git-secrets reveal"
  },
  "husky": {
    "hooks": {
      "pre-commit": "npm run secret:hide &amp;amp;&amp;amp; git add .",
      "post-commit": "npm run secret:reveal"
    }
  },

npm run secret:init

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

&lt;/div&gt;



&lt;p&gt;Now, add files you would like to encrypt before committing them to the config file.&lt;/p&gt;

&lt;p&gt;.git-secrets (can be any other file by setting env variable GIT_SECRETS_CONFIG)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;terraform.tfstate
variables.tf
secrets.json

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

&lt;/div&gt;



&lt;p&gt;The next step is to choose your secret password and pass it to git-secrets. You can pass the key by cli param (--key=secret), env variable (GIT_SECRETS_KEY), and by creating the key file (make sure you add this file to .gitignore, filename=.git-secrets.key)&lt;/p&gt;

&lt;p&gt;The final step is to test all our configurations, commit the changes we just added and check the files on GitHub to see the result.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;disclaimer: this is a work in progress and not safe for production or enterprise projects, but can do the trick for self-projects when the risk is low.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
    <item>
      <title>Javascript object reamp</title>
      <dc:creator>Nir Adler</dc:creator>
      <pubDate>Tue, 11 Feb 2020 09:59:30 +0000</pubDate>
      <link>https://dev.to/niradler/javascript-object-reamp-31in</link>
      <guid>https://dev.to/niradler/javascript-object-reamp-31in</guid>
      <description>&lt;p&gt;in my daily job as a full stack js developer I often need to manipulate js objects, either remove fields or transform to a new structure etc.&lt;/p&gt;

&lt;p&gt;I decided to create an npm module &lt;a href="https://github.com/niradler/object-remap"&gt;object-remap&lt;/a&gt;, to make this repeated task more reliable, reduce code, and create cleaner code.&lt;/p&gt;

&lt;p&gt;let's look at the examples:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const objectRemap = require("object-remap");

const obj = {
  a: 1,
  b: 2,
  c: 3,
  d: {
    e: 4,
    f: [1, 2, 3]
  }
};

//simple usage
const fields = ["a", "b", "c"];

let newObj = objectRemap(obj, fields);
console.log({ obj, newObj });
/*
{
  obj: { a: 1, b: 2, c: 3, d: { e: 4, f: [Array] } },
  newObj: { a: 1, b: 2, c: 3}
}
*/

//advance usage
const fieldsMap = [
  {
    origin: "a",
    target: "a"
  },
  {
    origin: "d.e",
    target: "e"
  },
  {
    origin: "d.f",
    target: "f",
    formatter: data =&amp;gt; `${data.length} items`
  }
];

newObj = objectRemap(obj, fieldsMap);
console.log({ obj, newObj });
/*
{ 
  obj: { a: 1, b: 2, c: 3, d: { e: 4, f: [Array] } },
  newObj: { a: 1, e: 4, f: '3 items' } 
}
*/

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

&lt;/div&gt;



&lt;p&gt;for getting started install the package with npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i -S object-remap

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

&lt;/div&gt;



</description>
    </item>
  </channel>
</rss>
