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

Rename config to variables #1918

Merged
merged 1 commit into from
Oct 24, 2023
Merged

Conversation

fibonacci1729
Copy link
Contributor

@fibonacci1729 fibonacci1729 commented Oct 19, 2023

  • Renames environment variables SPIN_CONFIG_* to SPIN_VARIABLE_* for the EnvVariablesProvider.
  • Renames runtime config manifest key from config_provider to variables_provider.
  • Moves crates/config to crates/variables.
  • All tests/examples updated.

@fibonacci1729
Copy link
Contributor Author

fibonacci1729 commented Oct 19, 2023

An annoying detail: the environment runtime variable provider is now confusingly named EnvVariableProvider. Open to naming suggestions if this irks others as well.

Cargo.toml Outdated Show resolved Hide resolved
crates/trigger/src/runtime_config.rs Outdated Show resolved Hide resolved
crates/variables/src/lib.rs Outdated Show resolved Hide resolved
crates/variables/src/lib.rs Outdated Show resolved Hide resolved
crates/trigger/src/runtime_config/variable_provider.rs Outdated Show resolved Hide resolved
@fibonacci1729 fibonacci1729 force-pushed the variables branch 3 times, most recently from 3881bb0 to fc5cb48 Compare October 19, 2023 20:40
Copy link
Collaborator

@rylev rylev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!! I have some small things I think we should address before we merge this though.

crates/variables/src/host_component.rs Outdated Show resolved Hide resolved
crates/variables/src/host_component.rs Show resolved Hide resolved
crates/variables/src/host_component.rs Outdated Show resolved Hide resolved
crates/variables/src/host_component.rs Show resolved Hide resolved
examples/config-rust/.env Show resolved Hide resolved
examples/spin-timer/deps/spin/variables.wit Show resolved Hide resolved
examples/spin-timer/deps/spin/variables.wit Show resolved Hide resolved
invalid-name(string),
provider(string),
other(string),
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to have a not-found error for when the requested variable is not found? Right now this gets encoded as a provider error which doesn't seem right.

Copy link
Collaborator

@lann lann Oct 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left it out because I didn't want to imply that not-found was a "normal" condition (like the v1 key-value no-such-key); not being able to resolve a variable is a programming or operational mistake.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's strange that this error is labeled as a provider error when it's fairly likely not a provider error. I think the most likely cause will be users thinking there is a variable name foo and there not actually being one.

It's not a huge deal that this gets rendered as provider("no variable named 'foo'") - the error is clear enough - it's just a bit strange is all.

I personally don't really see potential confusion from having another error case, but I guess I'm fine letting this go if everyone disagrees with me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a variant undefined to specifically refer to this case @rylev. Could you take another look at the code and let me know what you think?

sdk/rust/src/lib.rs Outdated Show resolved Hide resolved
examples/spin-timer/deps/spin/variables.wit Show resolved Hide resolved
crates/variables/src/provider/env.rs Outdated Show resolved Hide resolved
crates/variables/src/provider/env.rs Outdated Show resolved Hide resolved
invalid-name(string),
provider(string),
other(string),
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's strange that this error is labeled as a provider error when it's fairly likely not a provider error. I think the most likely cause will be users thinking there is a variable name foo and there not actually being one.

It's not a huge deal that this gets rendered as provider("no variable named 'foo'") - the error is clear enough - it's just a bit strange is all.

I personally don't really see potential confusion from having another error case, but I guess I'm fine letting this go if everyone disagrees with me.

Copy link
Contributor

@itowlson itowlson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of nits but otherwise LGTM!

crates/loader/Cargo.toml Outdated Show resolved Hide resolved
crates/trigger/src/runtime_config.rs Outdated Show resolved Hide resolved
crates/trigger/src/runtime_config.rs Outdated Show resolved Hide resolved
@fibonacci1729 fibonacci1729 force-pushed the variables branch 2 times, most recently from 2427936 to f05a6ea Compare October 23, 2023 21:34
@fibonacci1729 fibonacci1729 merged commit 42e8ef4 into fermyon:main Oct 24, 2023
9 checks passed
@fibonacci1729 fibonacci1729 deleted the variables branch October 24, 2023 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants