Git Product home page Git Product logo

localsettings-to-env's Introduction

Converting local.settings.json to .env or the other way around

This repo contains scripts (powershell & bash) to convert Azure functions local.settings.json files to .env files, or the other way around.

Powershell โ˜

A powershell script (.ps1) and module (.psm1) You can either run the powershell script or use it as a module.

Parameters

  • -FromEnv: Set this to "yes" if you want to convert a .env file to a local.settings.json file. By default, it is set to "no"
  • -Path: Set the path to the folder containing the file to convert. By default, it is the current directory

Use as a module

  1. In C:\Program Files\WindowsPowerShell\Modules, paste in the folder contained in this repo, with the .psm1 file inside
  2. In a powershell window, run Import-Module Convert-SettingsEnv (you don't need to run it several times, just once per session)
  3. Run the command Convert-SettingsEnv. You can pass in parameters if you'd like

Run the script

  1. Set the Execution Policy on your machine to RemoteSigned if you've never done it before: Set-ExecutionPolicy RemoteSigned
  2. In the folder that contains the script, run . .\convert-settings-env.ps1. You can pass in parameters if you'd like

Bash ๐Ÿฑโ€๐Ÿ

The convert-settings-env.sh can be invoked directly and supports converting back and forth between .env and local.settings.json.

Parameters

  • -e | --env (optional) flag to convert from env to json. Leave out to convert from json to env. (default json to env)
  • -o | --output (optional) Output file. (default is local.settings.json for -e and .env for otherwise.)
  • -i | --input (optional) Input file. (default is .env for -e and local.settings.json for otherwise.)
  • -f | --force (optional) Skip prompting for existing file. (default: false)
  • -v | --verbose (optional) Show detailed output log (default: false)
  • -h | --help (optional) Show help text. This :)

Dependencies:

  • jq - This bash script expects to find jq as a cli tool.

localsettings-to-env's People

Contributors

hattan avatar kagigz avatar

Watchers

 avatar

Forkers

hattan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.