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

[Feature request]: During setup if it finds an .env file skip asking for API keys. #341

Open
ptsiampas opened this issue Apr 12, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@ptsiampas
Copy link

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()
@ptsiampas ptsiampas added the enhancement New feature or request label Apr 12, 2024
@ksylvan
Copy link
Contributor

ksylvan commented Apr 20, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants