generated from algorandfoundation/algokit-beaker-default-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: removing .env files, adding env-file generator (#31)
* feat: refining template, removing env files, adding new env file generator * docs: refining docs * docs: refining docs * chore: apply suggestions from code review Co-authored-by: Neil Campbell <neil.campbell@makerx.com.au> * chore: minor tweaks in gitattributes * chore: hiding copier answers file --------- Co-authored-by: Neil Campbell <neil.campbell@makerx.com.au>
- Loading branch information
1 parent
3880851
commit f27e111
Showing
75 changed files
with
401 additions
and
190 deletions.
There are no files selected for viewing
8 changes: 6 additions & 2 deletions
8
examples/generators/production_python_smart_contract_python/.algokit.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
27 changes: 27 additions & 0 deletions
27
...s/production_python_smart_contract_python/.algokit/generators/create_env_file/copier.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
_tasks: | ||
- "echo '==== Successfully generated new .env file 🚀 ===='" | ||
|
||
use_generic_env: | ||
type: bool | ||
help: Create generic empty .env file (true) or create a network specific .env.{network_name} file (false). | ||
placeholder: "true" | ||
default: "true" | ||
|
||
target_network: | ||
type: str | ||
help: Name of your target network. | ||
choices: | ||
- mainnet | ||
- testnet | ||
- localnet | ||
- custom | ||
default: "localnet" | ||
when: "{{ not use_generic_env }}" | ||
|
||
custom_network_name: | ||
type: str | ||
help: Name of your custom Algorand network. | ||
placeholder: "custom" | ||
when: "{{ not use_generic_env and target_network == 'custom' }}" | ||
|
||
_templates_suffix: ".j2" |
7 changes: 7 additions & 0 deletions
7
...e_generic_env and target_network == 'custom' %}.env.{{custom_network_name}}.j2{% endif %}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# this file contains algorand network settings for interacting with testnet via algonode | ||
ALGOD_TOKEN={YOUR_ALGOD_TOKEN} | ||
ALGOD_SERVER={YOUR_ALGOD_SERVER_URL} | ||
ALGOD_PORT={YOUR_ALGOD_PORT} | ||
INDEXER_TOKEN={YOUR_INDEXER_TOKEN} | ||
INDEXER_SERVER={YOUR_INDEXER_SERVER_URL} | ||
INDEXER_PORT={YOUR_INDEXER_PORT} |
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
...le/{% if not use_generic_env and target_network == 'mainnet' %}.env.mainnet.j2{% endif %}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# this file contains algorand network settings for interacting with testnet via algonode | ||
ALGOD_SERVER=https://mainnet-api.algonode.cloud | ||
INDEXER_SERVER=https://mainnet-idx.algonode.cloud |
File renamed without changes.
Empty file.
1 change: 0 additions & 1 deletion
1
examples/generators/production_python_smart_contract_python/.env.template
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 0 additions & 9 deletions
9
...es/generators/production_python_smart_contract_python/smart_contracts/README.md
This file was deleted.
Oops, something went wrong.
24 changes: 9 additions & 15 deletions
24
examples/generators/production_python_smart_contract_python/tests/conftest.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,26 @@ | ||
from pathlib import Path | ||
|
||
import pytest | ||
from algokit_utils import ( | ||
get_algod_client, | ||
get_default_localnet_config, | ||
get_indexer_client, | ||
is_localnet, | ||
) | ||
from algosdk.v2client.algod import AlgodClient | ||
from algosdk.v2client.indexer import IndexerClient | ||
from dotenv import load_dotenv | ||
|
||
|
||
@pytest.fixture(autouse=True, scope="session") | ||
def environment_fixture() -> None: | ||
env_path = Path(__file__).parent.parent / ".env.localnet" | ||
load_dotenv(env_path) | ||
# Uncomment if you want to load network specific or generic .env file | ||
# @pytest.fixture(autouse=True, scope="session") | ||
# def environment_fixture() -> None: | ||
# env_path = Path(__file__).parent.parent / ".env" | ||
# load_dotenv(env_path) | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def algod_client() -> AlgodClient: | ||
client = get_algod_client() | ||
|
||
# you can remove this assertion to test on other networks, | ||
# included here to prevent accidentally running against other networks | ||
assert is_localnet(client) | ||
# by default we are using localnet algod | ||
client = get_algod_client(get_default_localnet_config("algod")) | ||
return client | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def indexer_client() -> IndexerClient: | ||
return get_indexer_client() | ||
return get_indexer_client(get_default_localnet_config("indexer")) |
8 changes: 6 additions & 2 deletions
8
examples/generators/production_python_smart_contract_typescript/.algokit.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
27 changes: 27 additions & 0 deletions
27
...oduction_python_smart_contract_typescript/.algokit/generators/create_env_file/copier.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
_tasks: | ||
- "echo '==== Successfully generated new .env file 🚀 ===='" | ||
|
||
use_generic_env: | ||
type: bool | ||
help: Create generic empty .env file (true) or create a network specific .env.{network_name} file (false). | ||
placeholder: "true" | ||
default: "true" | ||
|
||
target_network: | ||
type: str | ||
help: Name of your target network. | ||
choices: | ||
- mainnet | ||
- testnet | ||
- localnet | ||
- custom | ||
default: "localnet" | ||
when: "{{ not use_generic_env }}" | ||
|
||
custom_network_name: | ||
type: str | ||
help: Name of your custom Algorand network. | ||
placeholder: "custom" | ||
when: "{{ not use_generic_env and target_network == 'custom' }}" | ||
|
||
_templates_suffix: ".j2" |
7 changes: 7 additions & 0 deletions
7
...e_generic_env and target_network == 'custom' %}.env.{{custom_network_name}}.j2{% endif %}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# this file contains algorand network settings for interacting with testnet via algonode | ||
ALGOD_TOKEN={YOUR_ALGOD_TOKEN} | ||
ALGOD_SERVER={YOUR_ALGOD_SERVER_URL} | ||
ALGOD_PORT={YOUR_ALGOD_PORT} | ||
INDEXER_TOKEN={YOUR_INDEXER_TOKEN} | ||
INDEXER_SERVER={YOUR_INDEXER_SERVER_URL} | ||
INDEXER_PORT={YOUR_INDEXER_PORT} |
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
...le/{% if not use_generic_env and target_network == 'mainnet' %}.env.mainnet.j2{% endif %}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# this file contains algorand network settings for interacting with testnet via algonode | ||
ALGOD_SERVER=https://mainnet-api.algonode.cloud | ||
INDEXER_SERVER=https://mainnet-idx.algonode.cloud |
File renamed without changes.
Empty file.
1 change: 0 additions & 1 deletion
1
examples/generators/production_python_smart_contract_typescript/.env.template
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 0 additions & 10 deletions
10
...enerators/production_python_smart_contract_typescript/smart_contracts/README.md
This file was deleted.
Oops, something went wrong.
8 changes: 6 additions & 2 deletions
8
examples/generators/starter_python_smart_contract_python/.algokit.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
27 changes: 27 additions & 0 deletions
27
...tors/starter_python_smart_contract_python/.algokit/generators/create_env_file/copier.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
_tasks: | ||
- "echo '==== Successfully generated new .env file 🚀 ===='" | ||
|
||
use_generic_env: | ||
type: bool | ||
help: Create generic empty .env file (true) or create a network specific .env.{network_name} file (false). | ||
placeholder: "true" | ||
default: "true" | ||
|
||
target_network: | ||
type: str | ||
help: Name of your target network. | ||
choices: | ||
- mainnet | ||
- testnet | ||
- localnet | ||
- custom | ||
default: "localnet" | ||
when: "{{ not use_generic_env }}" | ||
|
||
custom_network_name: | ||
type: str | ||
help: Name of your custom Algorand network. | ||
placeholder: "custom" | ||
when: "{{ not use_generic_env and target_network == 'custom' }}" | ||
|
||
_templates_suffix: ".j2" |
7 changes: 7 additions & 0 deletions
7
...e_generic_env and target_network == 'custom' %}.env.{{custom_network_name}}.j2{% endif %}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# this file contains algorand network settings for interacting with testnet via algonode | ||
ALGOD_TOKEN={YOUR_ALGOD_TOKEN} | ||
ALGOD_SERVER={YOUR_ALGOD_SERVER_URL} | ||
ALGOD_PORT={YOUR_ALGOD_PORT} | ||
INDEXER_TOKEN={YOUR_INDEXER_TOKEN} | ||
INDEXER_SERVER={YOUR_INDEXER_SERVER_URL} | ||
INDEXER_PORT={YOUR_INDEXER_PORT} |
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
...le/{% if not use_generic_env and target_network == 'mainnet' %}.env.mainnet.j2{% endif %}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# this file contains algorand network settings for interacting with testnet via algonode | ||
ALGOD_SERVER=https://mainnet-api.algonode.cloud | ||
INDEXER_SERVER=https://mainnet-idx.algonode.cloud |
File renamed without changes.
Empty file.
1 change: 0 additions & 1 deletion
1
examples/generators/starter_python_smart_contract_python/.env.template
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.