l3p-cv / lost

Label Objects and Save Time (LOST) - Design your own smart Image Annotation process in a web-based environment.

Home Page:https://lost.training

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make quick_setup.py/write_env_config more clear

sokolegg opened this issue · comments

Hey! What do you think is it possible to rewrite current config write function? (def write_env_config)

Current look:

    def write_env_config(self, env_path):
        '''Write env file to filesystem

        Args:
            env_path (str): Path to store env file
        '''
        if self.args.no_ai:
            ai_examples = 'False'
        else:
            ai_examples = 'True'

        config = [
            ['#======================','#'],
            ['#=   LOST Basic conig  ','#'],
            ['#======================','#'],
            ['DEBUG','True'],
            ['# Add example pipelines and example images ','#'],
            ['ADD_EXAMPLES','True'],
            ['#= Add also ai pipelines if true. You will need the lost-cv worker to execute these pipelines.',' #'],
            ['ADD_AI_EXAMPLES', ai_examples],
            ['LOST_VERSION', self.release],
            ['#= LOST port binding to host machine',' #'],
            ['LOST_FRONTEND_PORT', 80],
            ['SECRET_KEY', self.secret_key],
            ['#= Path to LOST data in host filesystem',' #'],
            ['LOST_DATA', self.dst_data_dir],
            ['#======================','#'],
            ['#= LOST Database conig ','#'],
            ['#======================','#'],
            ['LOST_DB_NAME', 'lost'],
            ['LOST_DB_USER', 'lost'],
            ['LOST_DB_PASSWORD', 'LostDbLost'],
            ['LOST_DB_ROOT_PASSWORD', 'LostRootLost'],
            ['#======================','#'],
            ['#=   PipeEngine conig  ','#'],
            ['#======================','#'],
            ['# Interval in seconds for the cronjob to update the pipeline',' #'],
            ['PIPE_SCHEDULE', '5'],
            ['# Intervall in seconds in which a worker should give a lifesign',' #'],
            ['WORKER_BEAT', 10],
            ['# Timeout in seconds when a worker is considered to be dead',' #'],
            ['WORKER_TIMEOUT',30],
            ['#========================','#'],
            ['#= Your Mail config here ','#'],
            ['#========================','#'],
            ['#MAIL_SERVER','mailserver.com'],
            ['#MAIL_PORT','465'],
            ['#MAIL_USE_SSL','True'],
            ['#MAIL_USE_TLS','True'],
            ['#MAIL_USERNAME','email@email.com'],
            ['#MAIL_PASSWORD','password'],
            ['#MAIL_DEFAULT_SENDER','LOST Notification System <email@email.com>'],
            ['#MAIL_LOST_URL','http://mylostinstance.url/']
        ]
        with open(env_path, 'w') as f:
            for key, val in config:
                f.write('{}={}\n'.format(key, val))
        return

I mean create some config file near with quick_setup.py and just copy it to build path.
Or use jinja if we want to set some parameters using arguments for quick_setup.py.

I can contribute 🤝

Will have new configuration options in LOST 2.0.0.