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

feat(cli): Add support for environment variable and configuration file parameters #285

Open
1 task done
Tracked by #413
antiyro opened this issue Sep 25, 2024 · 3 comments · May be fixed by #494
Open
1 task done
Tracked by #413

feat(cli): Add support for environment variable and configuration file parameters #285

antiyro opened this issue Sep 25, 2024 · 3 comments · May be fixed by #494
Assignees
Labels
feature Request for new feature or enhancement infrastructure CI/CD, deployment and infrastructure changes

Comments

@antiyro
Copy link
Member

antiyro commented Sep 25, 2024

Is there an existing issue?

  • I have searched the existing issues

Motivation

The goal of this issue is to introduce 2 new methods for specifying parameters on Madara. Currently only cli arguments are supported.

Request

We would like to implement:

  1. Environment variables

Set up your node's environment variables using the MADARA_ prefix. For example:

MADARA_BASE_PATH=/path/to/data
MADARA_LOG=info

These variables allow you to adjust the node's configuration without using command-line arguments.

  1. Configuration files

You could use a JSON, TOML, or YAML file to structure your configuration settings. Specify your configuration file on startup with the -c option. Here's a basic example in JSON format:

{
  "name": "able-vps-2",
  "base_path": "../deoxys-db",
  "network": "devnet",
  "l1_endpoint": "key",
  "rpc_port": 9944,
  "rpc_cors": "*",
  "rpc_external": true,
  "prometheus_external": true
}

Configuration priority would be as follows: command-line arguments > environment variables > configuration files.
When the same setting is configured in multiple places, the source with the highest priority takes effect.

Solution

as described above

Are you willing to help with this request?

Yes!

@antiyro antiyro added this to Madara Sep 25, 2024
@antiyro antiyro added feature Request for new feature or enhancement infrastructure CI/CD, deployment and infrastructure changes labels Sep 25, 2024
@antiyro antiyro moved this to Ready in Madara Sep 25, 2024
@shamsasari
Copy link
Contributor

Shouldn't the priority be command-line arguments > configuration files > environment variables, i.e. env variables being least priority since they are least visible and least obvious in any deployment?

@shamsasari shamsasari moved this from Ready to In progress in Madara Oct 4, 2024
@shamsasari shamsasari self-assigned this Oct 4, 2024
shamsasari added a commit that referenced this issue Oct 4, 2024
They are specified with the prefix `MADARA_` followed by the command-line argument in screaming snake case.

This is part of #285.
@shamsasari
Copy link
Contributor

Support for env variables has been added in #311.

@antiyro
Copy link
Member Author

antiyro commented Oct 7, 2024

Shouldn't the priority be command-line arguments > configuration files > environment variables, i.e. env variables being least priority since they are least visible and least obvious in any deployment?

I prefere to have env > configuration files since configuration files are more dedicated to predefined and static production environments, whereas environment variables are very useful when values need to be changed frequently. Moreover, they are essential during our ci deployments.

@HermanObst HermanObst assigned GMKrieger and unassigned shamsasari Feb 10, 2025
@GMKrieger GMKrieger linked a pull request Feb 13, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Request for new feature or enhancement infrastructure CI/CD, deployment and infrastructure changes
Projects
Status: In progress
Development

Successfully merging a pull request may close this issue.

3 participants