-
Notifications
You must be signed in to change notification settings - Fork 18
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
refactor: 4th use environment vars instead of about.yaml #95
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made this as a comment in #57 before I looked at this PR, but I wonder if this is also a good opportunity to use a standard .env
filename instead of config.env
. Would be curious to get other LinkML developers' thoughts.
I'd agree with that in this PR, good suggestion. There is some open tooling which looks for a '.env' file, and auto loads environment vars if found. Chezmoi is one example, another called 'dotenv' I think. So it may be an official standard😊 There may also be value in using a standardized interface called '.config/' directory but I need to think about that. Its official standard for home directories, but I'm not 100% sure it's a standard for git repos. |
According to google search, .env may be best. There is also a .dotenv competing standard maybe, but I'd vote for .env |
@pkalita-lbl Looks like |
Maybe |
@pkalita-lbl we can go ahead with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff!
Just a note, when using a Specifically, GNU Make retains any quotes as literal quotes whereas diff --git a/Makefile b/Makefile
index 26adc0a..cf84f7e 100644
--- a/Makefile
+++ b/Makefile
@@ -6,6 +6,10 @@ SHELL := bash
.SUFFIXES:
.SECONDARY:
+# define temporary variable for $(call ...)
+1 :=
+unquote = $(patsubst "%,%,$(patsubst %",%,$(1)))
+
# environment variables
.EXPORT_ALL_VARIABLES:
ifdef LINKML_ENVIRONMENT_FILENAME
@@ -16,8 +20,8 @@ endif
RUN = poetry run
SCHEMA_NAME = $(LINKML_SCHEMA_NAME)
-SOURCE_SCHEMA_PATH = $(LINKML_SCHEMA_SOURCE_PATH)
-SOURCE_SCHEMA_DIR = $(dir $(SOURCE_SCHEMA_PATH))
+SOURCE_SCHEMA_PATH = $(call unquote,$(LINKML_SCHEMA_SOURCE_PATH))
+SOURCE_SCHEMA_DIR = $(patsubst %/,%,$(dir $(SOURCE_SCHEMA_PATH)))
SRC = src
DEST = project
PYMODEL = $(SRC)/$(SCHEMA_NAME)/datamodel I can make a PR for this. The other solution is not use quotes on some of the variables ( |
This PR refactors how schema definition is passed to makefile.
about.yaml
to.env.public
about.yaml
andutils/ directory
as not needed anymoreMakefile
to use environment variables from `.env.public.check-config
as part ofmake setup
to validateinclude .env.public
workedSee #57 (comment)