-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinstall.py
36 lines (30 loc) · 1.14 KB
/
install.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import os
import json
import argparse
# Function to create config/settings.json
def create_settings(ci_mode=False):
if ci_mode:
# Use default values for CI
api_key = "sk-test-key"
log_path = './var/logs/error.log'
debug = False
else:
# Prompt user for settings
api_key = input('Enter your OpenAI API key: ')
log_path = input('Enter the log directory path [default: ./var/logs/error.log]: ') or './var/logs/error.log'
debug = input('Enable debug mode? [y/n]: ').lower() == 'y'
# Save settings to JSON file
settings = {
'openai_api_key': api_key,
'log_path': log_path,
'debug': debug
}
os.makedirs('./config', exist_ok=True)
with open('./config/settings.json', 'w') as f:
json.dump(settings, f, indent=4)
print('Settings saved to config/settings.json')
if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Setup script for installation.')
parser.add_argument('--ci', action='store_true', help='Use default values for CI without prompting.')
args = parser.parse_args()
create_settings(ci_mode=args.ci)