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

Doppler: Environment variable management #14

Open
1 of 5 tasks
Gizmotronn opened this issue Dec 28, 2021 · 0 comments
Open
1 of 5 tasks

Doppler: Environment variable management #14

Gizmotronn opened this issue Dec 28, 2021 · 0 comments
Assignees
Labels
api-external API & Integrations with apps/programs not built by Signal-K bug Something isn't working documentation Improvements or additions to documentation

Comments

@Gizmotronn
Copy link
Member

Gizmotronn commented Dec 28, 2021

Problem:

  1. Need to have .env variables ready and accessible by the entire team
  2. Need to have the variables be easily accessible in .env files, and when cloning the repo so team members don't have to hunt through docs

Solution:

  • Link VSCode repos on Git, Keybase, with Doppler (on producthunt.com) or similar alternative. Make use of the Doppler API
  • Integrate that with the SK internal documentation
  • Create scaffolding in the repositories (e.g. deddit inside Smart contract for "deddit" #7, marketplace-games inside this repo) for .env management
  • Actually get the dotenv inside the repos to work
  • Related to the above, inside marketplace-games/web3-test-game, the code below doesn't work:
require("@nomiclabs/hardhat-waffle");
import dotenv from "dotenv";
dotenv.config();

// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html
task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
  const accounts = await hre.ethers.getSigners();

  for (const account of accounts) {
    console.log(account.address);
  }
});

// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more

/**
 * @type import('hardhat/config').HardhatUserConfig
 */
module.exports = {
  solidity: "0.8.0",
  networks: {
    rinkeby: {
      url: process.env.ALCHEMY_API_URL,
      accounts: [process.env.PRIVATE_KEY],
    },
  },
};
``` (`hardhat.config.js`)

Resulting in this output:
```bash
 npx hardhat run scripts/run.js 
An unexpected error occurred:

/Users/larbuckle/Documents/Blockchain/buildspace/thingdom/hardhat.config.js:2
import dotenv from "dotenv";
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1031:15)
    at Module._compile (node:internal/modules/cjs/loader:1065:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at importCsjOrEsModule (/Users/larbuckle/Documents/Blockchain/buildspace/thingdom/node_modules/hardhat/src/internal/core/config/config-loading.ts:23:20)
    at loadConfigAndTasks (/Users/larbuckle/Documents/Blockchain/buildspace/thingdom/node_modules/hardhat/src/internal/core/config/config-loading.ts:66:18)
@Gizmotronn Gizmotronn added bug Something isn't working documentation Improvements or additions to documentation api-external API & Integrations with apps/programs not built by Signal-K labels Dec 28, 2021
@Gizmotronn Gizmotronn self-assigned this Dec 28, 2021
@Gizmotronn Gizmotronn moved this to In Progress in ERC20 Token Dec 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-external API & Integrations with apps/programs not built by Signal-K bug Something isn't working documentation Improvements or additions to documentation
Projects
Status: In Progress
Development

No branches or pull requests

1 participant