Skip to content

Commit

Permalink
chore/nanocl: split substate into example
Browse files Browse the repository at this point in the history
  • Loading branch information
leon3s committed May 4, 2024
1 parent 4596b4d commit 0e1b311
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/guides/nanocl/advanced-usage/substate.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import StatefileBlock from '@site/src/components/statefile_block';

You can require other Statefiles in your Statefile using the `SubStates` key.

This is useful if you need to reuse a statefile in multiple places.
This is useful if you need to reuse a statefile in multiple places.<br />
Or in a mono-repository settings to have a single source of truth for your state.

There is an example of how to use it:

<StatefileBlock example="advanced/substate.yml" />
<StatefileBlock example="advanced/substate" />
36 changes: 36 additions & 0 deletions examples/advanced/substate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
ApiVersion: $NANOCL_VERSION

Namespace: global

SubStates:
# You can require substates from remote urls
- https://nhnr.io/v0.14/tests/sub_state.yml
# Or from local files
- ./sub_child.yml
# If you substate have arguments, you can pass them like this
- Path: ./sub_child.yml
Args:
- Name: my-arg
Value: my-value

# See all options:
# https://docs.next-hat.com/references/nanocl/objects/cargo
Cargoes:
- Name: my-cargo
Container:
Image: ghcr.io/next-hat/nanocl-get-started:latest

# See all options:
# https://docs.next-hat.com/references/nanocl/objects/resource
Resources:
- Name: deploy-example.com
Kind: ncproxy.io/rule/$NCPROXY_VERSION
Data:
Rules:
- Domain: deploy-example.com
Network: All
Locations:
- Path: /
Target:
Key: my-cargo.global.c
Port: 9000

0 comments on commit 0e1b311

Please sign in to comment.