fabric
fabric copied to clipboard
[Feature request]: During setup if it finds an .env file skip asking for API keys.
What do you need?
I am automating the installation of Fabric with Ansible. My existing .env
file is placed into the $HOME/.config/fabric
(I created it in a previous step) directory before I run the fabric --setup
, but due to the questions, it stalls.
Is it possible to put an if statement to check?
Like:
print("Welcome to Fabric. Let's get started.")
# Check if .env file exists
if not os.path.exists(self.env_file):
apikey = input(
"Please enter your OpenAI API key. If you do not have one or if you have already entered it, press enter.\n")
self.api_key(apikey)
print("Please enter your claude API key. If you do not have one, or if you have already entered it, press enter.\n")
claudekey = input()
self.claude_key(claudekey)
print("Please enter your YouTube API key. If you do not have one, or if you have already entered it, press enter.\n")
youtubekey = input()
self.youtube_key(youtubekey)
# Continue with patterns method
self.patterns()
What are you doing in your ansible script if the .env
file in ~/.config/fabric/
does not exist?
You can use the yes
program to feed linefeeds to the fabric --setup
which will still update the patterns:
% yes "" | fabric --setup
Welcome to Fabric. Let's get started.
Please enter your OpenAI API key. If you do not have one or if you have already entered it, press enter.
Please enter your claude API key. If you do not have one, or if you have already entered it, press enter.
Please enter your YouTube API key. If you do not have one, or if you have already entered it, press enter.
Updating patterns...
Downloaded zip file successfully.
Extracted zip file successfully.
Patterns updated successfully.
I am trying to set this up in a docker image, and this feature would also make the implementation better.
In the current Go variante of fabric, you just your .env file to the config folder and execute
fabric -U
to update the patterns. You don't need to execute
fabric --setup